Stream an PdfExport doesn't work


11-08-2005, 3:04 PM
I am not sure if this is a known problem or not, but if I do a pdf export it exports to a file fine.  But if I stream it out it just opens a blank browser window and nothing shows up.  It is an empty source.

This is the code I am using: (I got from your sample..)

' Tell the browser this is a PDF document so it will use an appropriate viewer.
' If the report has been exported in a different format, the content-type will

' need to be changed as noted in the following table:

' ExportType ContentType

' PDF "application/pdf" (needs to be in lowercase)

' RTF "application/rtf"

' TIFF "image/tiff" (will open in separate viewer instead of browser)

' HTML "message/rfc822" (only applies to compressed HTML pages that includes images)

' Excel "application/vnd.ms-excel"

' Excel "application/excel" (either of these types should work.

' Text "text/plain"

Response.Clear()

Response.ClearHeaders()

Response.ClearContent()

Response.ContentType = "application/pdf"

' IE & Acrobat seam to require "content-disposition" header being in the response. If you don't add it, the doc still works most of the time, but not always.

'this makes a new window appear: Response.AddHeader("content-disposition","attachment; filename=MyPDF.PDF");

Response.AddHeader( "content-disposition", "inline; filename=MyPDF.PDF" )

' Create the PDF export object

Dim pdf As New PdfExport

' Create a new memory stream that will hold the pdf output

Dim memStream As New System.IO.MemoryStream()

' Export the report to PDF:

pdf.Export(rpt.Document, memStream)

pdf.Export(rpt.Document, "C:\Test\file.pdf" )

' Write the PDF stream out

Response.BinaryWrite(memStream.ToArray())

' Send all buffered content to the client

Response.End()


The export to file works fine.

Thanks,
Cory Jorgensen
Bitco Software


Thank you,

Cory Jorgensen
Bitco Software

Re: Stream an PdfExport doesn't work


11-08-2005, 3:25 PM
Sir,
       Try to use this code.

Private Sub Page_Load(ByVal sender As Object , ByVal e As System. EventArgs ) Handles _

MyBase.Load

Dim m_stream As New System.IO.MemoryStream()

Dim rpt As New rptCustEx()

rpt.Run()

Me.PdfExport1.Export(rpt.Document, m_stream)

m_stream.Position = 0

Response.ContentType = "application/pdf"

Response.AddHeader( "content-disposition" , "inline; filename=MyExport.pdf" )

Response.BinaryWrite(m_stream.ToArray())

Response.End()

End Sub


 

Rakesh Jani

Re: Stream an PdfExport doesn't work


11-08-2005, 3:47 PM
I still get a blank screen.

This code that I have works fine with my other applications in VS 2003 and ActiveReports 1.0

Thanks,
Cory Jorgensen
Bitco Software
Thank you,

Cory Jorgensen
Bitco Software

Re: Stream an PdfExport doesn't work


11-08-2005, 4:09 PM
Ok,  here is what I did.

I created a new web project, created a new report and then the code works and the report is created and streamed as a PDF.

For some reason it isn't streaming my reports imported from VS 2003 using AR V1.

Why would it create the PDF file without any problem but not stream it?

Thanks,
Cory Jorgensen
Bitco Software
Thank you,

Cory Jorgensen
Bitco Software

Re: Stream an PdfExport doesn't work


11-08-2005, 4:29 PM
which version of acrobat reader do you have on your machine?
Rakesh Jani

Re: Stream an PdfExport doesn't work


11-08-2005, 4:45 PM
Adobe Acrobat 6.0 Standard
Thank you,

Cory Jorgensen
Bitco Software

Re: Stream an PdfExport doesn't work


11-08-2005, 4:51 PM
Good Call.  I tried it on a machine with Acrobat 6.0 Reader and it works fine.

It doesn't seem to work with Acrobat 6.0 Standard edition.  The older version of Active Reports 1 works fine with it.

Now What?

Cory Jorgensen
Bitco Software
Thank you,

Cory Jorgensen
Bitco Software

Re: Stream an PdfExport doesn't work


11-09-2005, 12:30 PM
Sir,
      I will let you know what i find. I am using 7.0.5.
Rakesh Jani

Re: Stream an PdfExport doesn't work


11-10-2005, 6:38 PM
i've seen similar behavior dealing with acrobat 6.  the hack i've discovered is if you append a "*.pdf" onto the query string the browser will be forced to launch the acrobat reader.  ex: "http://streamPage.aspx?foo.pdf"