Outputing a .pdf stream to current window

D

Dan Kimhi

I'm using the following lines to output a Crystal Report object to a
webForm:



Dim s As System.IO.MemoryStream =
cr.ExportToStream(CrystalDecisions.Shared].ExportFormatType.PortableDocFormat)

With Response

.Buffer = True

.ClearContent()

.ClearHeaders()

.ContentType = "application/pdf"

.BinaryWrite(s.ToArray)

.End()

End With



The report is opened in a new window; however, if I replace
..BinaryWrite(s.ToArray) by let's say .Write("hello"), I get it to output
in the same window.



How could I force the report (pdf format) to open in the same window?



Thanks for your help.





Dan Kimhi
 
M

Matt Berther

Hello Dan,

You'll need to add the Content-Disposition header.

Response.AddHeader("Content-Disposition", "inline;filename=report.pdf")
 
D

Dan Kimhi

Hi Matt,

Thanks. But, I'm still getting the same after adding "Content-Disposition".
Am I doing anything wrong? Why does it work with the .Write(string) ?

Dan Kimhi



Matt Berther said:
Hello Dan,

You'll need to add the Content-Disposition header.

Response.AddHeader("Content-Disposition", "inline;filename=report.pdf")

--
Matt Berther
http://www.mattberther.com
I'm using the following lines to output a Crystal Report object to a
webForm:

Dim s As System.IO.MemoryStream =
cr.ExportToStream(CrystalDecisions.Shared].ExportFormatType.PortableDo
cFormat)

With Response

.Buffer = True

.ClearContent()

.ClearHeaders()

.ContentType = "application/pdf"

.BinaryWrite(s.ToArray)

.End()

End With

The report is opened in a new window; however, if I replace
.BinaryWrite(s.ToArray) by let's say .Write("hello"), I get it to
output in the same window.

How could I force the report (pdf format) to open in the same window?

Thanks for your help.

Dan Kimhi
 

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
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top