|
Rank: Newbie Groups: Member
Joined: 5/13/2011 Posts: 3
|
How do you get a pdf you are creating to output in System.IO.Stream so you don't have to save it on the web server in order to download?
Thanks in advance.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You just call PdfDocument.Save(Stream).
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/13/2011 Posts: 3
|
Tried that but receive an error stating that the document is corrupt. If I save the same output to the disk first then it works fine. (doc.Save(Request.PhysicalApplicationPath + "\pdf\" & "Aru" & lQuote.text & ".pdf")) I'm thinking it has to be my response.
Code: Visual Basic.NET
Response.Clear()
Response.AddHeader("content-disposition", "attachment; filename=Aru" & lQuote.Text & ".pdf")
Response.ContentType = "application/pdf"
doc.Save(Response.OutputStream)
Response.[End]()
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
As long as you can save to disk fine, it means the PDF part is working fine and the problem is somewhere else. PdfDocument doesn't really care about what kind of streams you give to it. The code you posted appears to be fine. So you might want to see if you can get a static PDF file to send to your browser that way (read a static PDF file into a byte array and then write into Response.OutputStream) just to see if the problem is anywhere else.
Thanks!
|
|