I’m looking for concatenate two FileStreams to get one MemoryStream and then, convert it to PDF file.
Both of my input files are PDF files.
PdfFileEditor editor = new PdfFileEditor();
FileStream fs1 = new FileStream(@“C:\Aspose\test1.pdf”, FileMode.Open);
FileStream fs2 = new FileStream(@“C:\Aspose\test2.pdf”, FileMode.Open);
MemoryStream outStream = new MemoryStream();
editor.Concatenate(fileStream1, fileStream2, outStream);
PdfFileInfo fi = new PdfFileInfo(outStream);
An exception occured during the instantiation of “fi”. -> Invalid pdf format:pdf head signature is not found!: v22.214.171.124.
But, when I use the already concatenated file stream by using :
FileStream fs = new FileStream(@“C:\Aspose\concatenate.pdf”, FileMode.Open);
The line :
PdfFileInfo fi = new PdfFileInfo(fs);
Have I done something wrong ? Have I used MemoryStream in the wrong way ?
By the way, I know I can get a FileStream instead of my MemoryStream but I want to work without physical files.
Can you please try to add the following statement before passing outStream to the PdfFileInfo object?
If it doesn’t resolve your issue then please share the sample PDF files with us, so we could test the issue at our end.
We’re sorry for the inconvenience.
Thanks for your help.