Sales
1-888-9DOTNET
|
Essential Pdf does provide support for reading and writing Pdf documents from or to the System.IO.Stream. We can store this pdf document stream in to the database as binary object in the database. C# // Store the PDF document in DataBase //Initialize a stream MemoryStream stream = new MemoryStream(); // Save the document to stream doc.Save(stream); // Retrieve and display the stream in PDFformat OleDbDataReader Reader = command.ExecuteReader(); byte[] PdfFile = (byte[]) Reader[1]; Stream strm = new MemoryStream(PdfFile); using (FileStream fstream = new FileStream("sample.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite)) { fstream.Write(PdfFile, 0, PdfFile.Length); } VB ' Store the PDF document in DataBase 'Initialize a stream Dim stream As MemoryStream = New MemoryStream() ' Save the document to stream doc.Save(stream) ' Retrieve and display the stream in PDFformat Dim Reader As OleDbDataReader = command.ExecuteReader() Dim PdfFile As Byte() = CType(Reader(1), Byte()) Dim strm As Stream = New MemoryStream(PdfFile) Using fstream As FileStream = New FileStream("sample.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite) fstream.Write(PdfFile, 0, PdfFile.Length) End Using Please do find the sample from the below specified location, http://www.syncfusion.com/support/user/uploads/PdfDataBaseDemo_f1a61b02.zip |