How do you add existing Pdf pages to a new pdf using Pdf.Generator

How do I merge existing pages from a PDF in to a new pdf being created by Pdf.Generator?

Hi Nixon,

Thanks for your interest in our products.

You can save the PDF document being generated into some Stream Object and try using the code snippet specified over following link to for information on how to
Insert Array Of PDF Pages Using File Paths (Facades)

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

Great,


thank you for the response. Can you tell me if it can be done using the Pdf.Generator.Pdf object? I’m concatenating a number of files include word documents, excel, tif, jpg etc. all in to one Pdf file. Some of the files I need to render as images to include them but I should not have to do that with a Pdf file that needs to be added.

As I look through the list of files I want to add the “Pages” from each Pdf file I encounter into the new one I’m build with Pdf.Generator.Pdf.

I have already tried Saving the Pdf.Generator.Pdf instance to a memory stream, then used the memory stream to create a Pdf.Document which I then add the .Pages from the existing file I want to merge.

The issue I have is that I can’t load that back in to a Pdf.Generator.Pdf to continue merging/adding additional file in to it. Can you tell me how I would accomplish that?

Hi Nixon,

Let me share some details regarding namespaces being offered in Aspose.Pdf for .NET

Aspose.Pdf namespace offers the Document class which can be used to create PDF documents from scratch as well as you can use the same class to edit/manipulate existing PDF documents.

Aspose.Pdf.Generator name space only provides the capability to create PDF documents from scratch. You can use its API, convert an Image file to PDF, convert a simple Text file, transform an XML/XSL-FO file or even you can render the HTML file into PDF format using classes in this namespace. I am afraid it does not provide the feature to open an existing PDF document.

Aspose.Pdf.Facades namespace provides the capabilities to manipulate/edit existing PDF documents. It provides the capability to render the pages of PDF file into Image format, concatenate PDF files, Insert pages into existing PDF file, add watermark stamps in existing PDF files, delete pages from PDF and much more.

As per your requirement, the viable approach would be to first create PDF documents using Aspose.Pdf or Aspose.Pdf.Generator namespace and then you can merge the resultant files into single PDF by using Aspose.Pdf or Aspose.Pdf.Facades namespace. Please do let me know if I can be of any further assistance.