Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu May 04, 2017 11:36 am

I have converted the pdf in to bytes ands stored in database.

Below is the source code

pdf.SaveToFile(strPDFFormatFileName, FileFormat.PDF);

// Writing in to bytes to store in database

byte[] fileContentsPDF = null;
using (MemoryStream stream = new MemoryStream())
{
pdf.SaveToStream(stream, Spire.Pdf.FileFormat.PDF);
fileContentsPDF = stream.ToArray();
}

Wheni try to retrieve it and open the pdf it is coming as plain pdf document.

Below is the source code

byte[] op = { data will be fetched from database and assigned to this variable)
pdf.LoadFromBytes(op);
pdf.SaveToFile(strPDFFormatFileName, FileFormat.PDF);


Please advice

yuvarajsalla
 
Posts: 2
Joined: Wed May 03, 2017 10:05 am

Fri May 05, 2017 8:51 am

Dear yuvarajsalla,

Thanks for your inquiry.
After an initial test, sorry that I didn't notice the issue you mentioned. Could you please compare the byte fileContentsPDF with the byte op you fetched from database ? Is the length of them the same ? And please provide us with the input PDF file which has the issue you mentioned and the byte op for investigation.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF