Dispaly PDF file from Database

drpkrupa

Registered User.
Local time
Today, 13:04
Joined
Jun 1, 2009
Messages
13
I have a Access database. The table are link tables. They link to SQL database. I have a table called Images. It has ID, Account_No,Image_name, Image_Type and Image_data columns.
Image type has type of file. All files are PDF so it contain value "application/pdf". Image_data has actual file in binary format.

I have an Access form where i display all image data by account no.
Account_No,Image_Name,Link called "Click here"

I want a open file as soon as user click on click here link. I want a pull binary data from database, convert to image and display the pdf file into pdf viwer. I need help to write code. Here what i did so far.

VSQL = "SELECT TOP 1 Image_Data,File_type FROM PPAP_Drawing WHERE ID = " & ImageId

Dim rs As New ADODB.Recordset
Call rs.Open(VSQL, CurrentProject.Connection, 2, 2)

With rs
If Not .EOF Then
.MoveFirst
Do While Not .EOF
v = rs(0)
c = rs(1)
' Write code to conver binary data to pdf and open file into pdf viewer

.MoveNext
Loop
End If
.Close
End With
Set rs = Nothing
 
Here is a link to a demo that allows you to read long binary data and convert it to it image format and allows you to open the image in its native software. You need to be looking at the BlobTofile section.

Demo

David
 

Users who are viewing this thread

Back
Top Bottom