Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 5th, 2006, 11:32 AM
Registered User
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing Crystal Report as PDF

I am trying to send a crystal report to PDF through a binary stream using the code below:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            strFrom = Session("From")
            strTo = Session("To")
            strDivision = Session("Division")

            SpWithViewer(strFrom, strTo, strDivision)

            Report = New Routed()

        Catch er As Exception
            LogError(er.ToString, "RoutedReport")
            Exit Try
        End Try
    End Sub

Public Sub PrintToPdfWithStream(ByVal MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument)
        Dim MyExportOptions As New CrystalDecisions.Shared.ExportOptions()
        MyExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
        Dim MyExportRequestContext As New CrystalDecisions.Shared.ExportRequestContext()
        MyExportRequestContext.ExportInfo = MyExportOptions
        Dim MyStream As System.IO.Stream
        MyStream = MyReport.FormatEngine.ExportToStream(MyExportRequestContext)
        Response.ContentType = "application/pdf"
        Dim MyBuffer(MyStream.Length) As Byte
        MyStream.Read(MyBuffer, 0, CType(MyStream.Length, Integer))
 End Sub

However, every time it gets to this line:
    MyStream = MyReport.FormatEngine.ExportToStream(MyExportReque stContext)
a ParameterFieldCurrentValue exception is thrown saying there is a missing parameter.

Any suggestions are greatly appreciated. Thanks in advance.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import pdf to Crystal Report farzin2009 Crystal Reports 0 September 9th, 2008 02:33 AM
Crystal Report printing k.manisha ASP.NET 1.0 and 1.1 Professional 0 September 30th, 2006 01:11 AM
Convert Crystal Report 8 to PDF rsamanthif Crystal Reports 1 January 2nd, 2006 03:53 AM
Error While printing report (Crystal report) vikaspaweb Pro VB 6 0 March 8th, 2004 09:53 AM
Pdf Crystal Report export Kristoff Crystal Reports 1 October 21st, 2003 09:38 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.