Crystal Report Export to PDF Inline Fails

E

emarvets

I am working (unsuccessfully) with Crystal XI. I create a report and
export it to pdf. It works fine when I set it to an attachment, but
nothing appears to happen when I switch over to inline. Here is my
code:


Dim CRLeaveSlip As New LeaveSlip
CRLeaveSlip.SetDataSource(MasterDataSet)

Dim s As MemoryStream

s =
DirectCast(CRLeaveSlip.ExportToStream(ExportFormatType.PortableDocFormat),
MemoryStream)

Page.Visible = False
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.AppendHeader("content-length",
s.Length.ToString())
Response.AppendHeader("content-disposition", "inline;
filename=LeaveSlip.pdf")
Response.BinaryWrite(s.ToArray)
Response.Flush()
Response.Close()
Response.End()

This works fine but as an attachment:


Dim CRLeaveSlip As New LeaveSlip
CRLeaveSlip.SetDataSource(MasterDataSet)

Dim s As MemoryStream

s =
DirectCast(CRLeaveSlip.ExportToStream(ExportFormatType.PortableDocFormat),
MemoryStream)


Page.Visible = False
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.AppendHeader("content-length",
s.Length.ToString())
Response.AppendHeader("content-disposition", "attachment;
filename=LeaveSlip.pdf")
Response.BinaryWrite(s.ToArray)
Response.Flush()
Response.Close()
Response.End()


A couple of other things I noted while bashing my head against a brick
wall:

The AcroRd32.exe process starts when the inline page is sent to the
browser, even though the page never appears to change
IE reports "Downloaded 0KB" in the bottom left of the screen in the
status bar

Setting the content-encoding to gzip sets IE to a blank page

Any help is greatly appreciated,

Eric Marvets
Visual Developer, Security MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top