Concatenating PDFs in memory

Hi there,

I am using the Aspose.Pdf for .NET library and want to concatenate merge documents in memory. I have the following scenario -

1. Create a new instance of the Aspose.Pdf.Generator.Pdf object

2. Load an existing PDF from the file system

3. Add it to the new Pdf object

4. Repeat step 3 and 4

5. Output the Pdf object as a byte array.

Please can you advise. At the moment I can find examples of loading concatenating Pdf documents on the file system and writing to the file system but I cannot find any examples of how to iterate over existing Pdf documents and add them to a Aspose.Pdf.Generator.Pdf object.



Hi Tom,

Thanks for your interest in our products.

In order to accomplish your requirements, first you need to create a PDF file using Aspose.Pdf.Generator namespace, save the output in MemoryStream object, use FileStream or MemoryStream object to load existing PDF files, and try using Concatenate(…) method of PdfFileEditor class present under Aspose.Pdf.Facades namespace. Please visit the following link for further information on Concatenate multiple PDF files using MemoryStreams

In case of any further query, please feel free to contact.