Free Support Forum - aspose.com

Conversion and merge one file at a time

We have a collection of PDF files, SVG files, and images which our product manager wants to be able to check off a few of each and end up with a single pdf file that can be viewed, printed, or saved.


I found all I needed to create individual pdf documents with each type of data (SVG or Image) but there is one piece missing.

I need to take that single pdf, load it up into a pdf document, and if there are additional products then continue to concatonate the pdf documents until all requested objects are processed. At that point I need to save the huge merged file and return it in a byte stream. (easy part of the puzzle)

So how do I create a Document and continue to append pdf fragments until I want to save the entire merged file?

Hi Michael,


Thanks for your interest in our products.

Aspose.Pdf for .NET supports the feature to Convert SVG and Image files into PDF format and also offers the capability to concatenate individual PDF documents and generate a single resultant PDF file. As per your requirement,

  1. you can use Aspose.Pdf for .NET to convert individual SVG and Image files to PDF format.
  2. Save the output file to MemoryStream object
  3. Load existing PDF file using Aspose.Pdf.Document object
  4. concatenate PDF files generated in step 2 and merge them with main PDF file loaded in step 3.
  5. Finally you can save the output in MemoryStream and get the Byte array.

For further information, please visit

That is more or less the approach I ended up taking using the Document object.


So if I create a pdf with an image and then do a Document.Pages.Add(imageDocument.Pages) do I need to also add the resource object (image) to the merged document? Or is the image now drawn into the pdf and no longer need the image object. (the purpose is viewing only)
meber:
So if I create a pdf with an image and then do a Document.Pages.Add(imageDocument.Pages) do I need to also add the resource object (image) to the merged document? Or is the image now drawn into the pdf and no longer need the image object. (the purpose is viewing only)
Hi Michael,

Sorry for the delayed response.

Please note that once the image (SVG, Raster) is converted into PDF format, there is no need to keep track of Image object because its placed into PDF file and when you concatenate PDF files using Pages.Add(..) method, the resources are automatically placed in resultant PDF file.

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