Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hiii
how to pdf file open in browser using database and pdf file save as varbinary(MAX).

Please give me a solution.
Posted
Updated 19-May-14 22:39pm
v2
Comments
ZurdoDev 19-May-14 8:15am    
Where are you stuck?

Use a folder that can hold temporary files. Save the file (with a unique filename!) to this folder and provide the link to the user. Keep the filename in the Session object.

When the session ends (I believe this is an event in the global.asax file) you can use that value and delete the file from disk again.

Hope this helps.
 
Share this answer
 
Comments
Ashish Darji 20-May-14 1:14am    
thanx for Answer
Ashish Darji 20-May-14 2:50am    
Please send code on my mail address ashish.darji09@gmail.com
V. 20-May-14 2:53am    
euhm, no
You can check out this link : http://www.rent-acoder.com/ if you want the code provided for you.
One thing I can tell you is that the folder holding the files should be added to IIS as a virtual folder. Try that first and place some docx or pdf files in there. Then try to open via the browser...
Hi Try like this ,get binary files form sql and using file stream u save in temp folder and show pdf form that temp folder.

VB
 Dim buffer As Byte()
 buffer = fadt(0)("PDF")'--This pdf in the form of binary
Dim fs As FileStream = File.Create(docflxpath)'---Save pdf path
fs.Write(buffer, 0, buffer.Length)
fs.Close()
fs.Dispose()
buffer = Nothing


in above i will select file name ,binary form and that binary form fill in datatable,here i use fadt and using this datatable i will pass that binary to buffer and docflxpath is saving pdf file path ,in this u give like "C:\test\documentname.pdf" then it save documentname with .pdf in C:\test

then show pdf form C:\test folder .


Note :
for docflxpath u need to give name and add .pdf at last

Regards
Aravind
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900