Is there anyway to stream a file stored in a database directly to an AxAcroPDF control?
Posted on 2007-08-10
I have a database that I store PDF files in. I retreive these files using the below routine by retreiving the binary data into an array and then saving that array data to a file on the hard drive as a PDF. I can then display the PDF in an AxAcroPDF control. This code works perfectly.
Sub GetFile(ByVal table As String, ByVal field As String, ByVal filename As String, ByVal condition As String)
'Retreives binary data from database and loads it into a file.
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM " & table & " WHERE " & condition, connectionString)
Dim ds As New DataSet()
arr = ds.Tables(0).Rows(0).Item(field) 'Retieve data into the binary array.
FileOpen(1, filename, OpenMode.Binary) 'Open file
FilePut(1, arr) 'Dump data into file.
FileClose(1) 'Close file
Catch ex As Exception
My Question is:
Is there anyway to stream the file directly from the database to the AxAcroPDF control without first saving the file on the hard drive?