Dear sir
I have a task to uplode PDF file data store in/convert Microsoft Sql Server database . if have any solution plz reply me .ASAP
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Maen BadwanPosted Sep 1, 2016, 9:36 AM
If yes, I think you can do this as follows:
1. Create a new field of type VarBinary(Max) in your database table.
2. In your C# code, read the PDF data into a byte array using the ReadAllBytes method as follows:
--------------------------------------------------------------------------
byte[] PDFfileBytes = System.IO.File.ReadAllBytes(@"Source.pdf");
--------------------------------------------------------------------------
3. Insert the PDF byte array in the database using the SQL Insert statement.
After this, you can read it back from the database into a byte[], and save this byte[] array to a file on disk using the System.IO.File.WriteAllBytes method.
Now, if you are looking for a way to display the PDF files after Loading them back from the database, you can use a programming toolkit (like LEADTOOLS) to load the PDF file and display it on a viewer. You can find more details here:
https://www.leadtools.com/help/leadtools/v19/dh/javascript/to/leadtools.topics.documents.ui~doxui.topics.documentviewer_using.html
Disclaimer: I am employee of the LEADTOOLS product