Question : Can I restore a PDF Document once it has been saved as Image datatype?

I have saved a PDF document to my SQL server 2005 database into a field that is datatype Image - this works fine.
Is there a way to fetch the file back from the database and display it as a PDF again? Or do I have to display it as an image? I am using VB.NET
The code I used to write the image is below and works fine:
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Dim fsFile As New System.IO.FileStream(PDF_Filename, IO.FileMode.Open, IO.FileAccess.Read)
        Dim intFileLen As Int32 = Convert.ToInt32(fsFile.Length)
        Dim imgData(fsFile.Length) As Byte
        Dim oConnection As SqlConnection = Nothing
 
        oConnection = GetConnection(MyConnectionString)
        fsFile.Read(imgData, 0, intFileLen)
        fsFile.Close()
 
        Dim oParam(2) As SqlParameter
 
           oParam(0) = New SqlParameter("Doc_ID", 1)
            oParam(1) = New SqlParameter("Doc_Title", PDF_Title)
            oParam(2) = New SqlParameter("Picture", imgData)
            SqlHelper.Executenonquery(oConnection, "sp_Add_PDF", oParam)
Open in New Window Select All

Answer : Can I restore a PDF Document once it has been saved as Image datatype?

I actully found that as long as you give the document the correct extension you can simply re-extract it as a bytestream and write it to disc with the .pdf extension. This file can then simply be picked up by the web browser control.
Random Solutions  
 
programming4us programming4us