I am new to using Aspose.Pdf.Kit. I am trying to Append multiple PDF documents togeter. I can do this by specifying the path of the documents or by using FileStream to load the documents and then call the Append method. I am trying to do the same using MemoryStream instead of FileStream as all my PDF files are stored binary in the database.
However when I use MemoryStream instead of File Stream I am getting error:
"Invalid pdf format:pdf head signature is not found!: v188.8.131.52 - "
In the same example if I am using FileStream I have no issues.
Here is my test code (here I just converted FileStream to MemoryStream for testing but when using in application I will get memory stream from database)
//Initialize the string variables storing paths of PDF files
string inFile1 = "\\input1.pdf";
string inFile2 = "\\input2.pdf";
//Creating stream objects holding the PDF files in Open Mode
FileStream inStream1 = new FileStream(inFile1, FileMode.Open);
FileStream inStream2 = new FileStream(inFile2, FileMode.Open);
MemoryStream storeStream1 = new MemoryStream();
MemoryStream storeStream2 = new MemoryStream();
MemoryStream storeStream3 = new MemoryStream();
inStream1.Read(storeStream1.GetBuffer(), 0, (int)inStream1.Length);
inStream2.Read(storeStream1.GetBuffer(), 0, (int)inStream2.Length);
//Instantiating PdfFileEditor object
PdfFileEditor editor = new PdfFileEditor();
//Calling Append method and providing five arguments
editor.Append(storeStream1, storeStream2, 1, 1, storeStream3);
This message was posted using Aspose.Live 2 Forum