How to create a PDF file from a BLOB

  • Thread starter Thread starter tofu.captain
  • Start date Start date
T

tofu.captain

I have PDFs saved in a SQL 2005 server as BLOBs. I would like to
extract the BLOBs and either:

1. create a PDF file on the hard disk
or
2. open/stream the PDF into the application

I am using a VB.net winform (not a web form).

How would I go about doing this? I use CutePDF to initially convert a
PDF file and store it into the SQL server, but I must purge the PDF
file from the system.
 
hi
first thing to do is get your binary info from the database.
then you have the following options for sending a file to a browser:

Response.BinaryWrite (write binary info to browser)
Response.WriteFile (write a file to browser with all-at-once server
memory)
Response.TransmitFile (write a file to browser without using server
memory)

make sure to set the content type as application/pdf. e.g.:
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition",
"attachment;filename=\"Whatever.pdf\"");


hope this helps
tim
 
Back
Top