Free Support Forum - aspose.com

Merging multiple PDF- which is the best approach

I want to concatenate multiple PDF files into one single PDF. I found there are two ways i can do that using ASPOSE.PDF for Net
The number of files im trying to merge are between 10 to 100. I want to know which is the best way in terms of Performance and Memory Optimization.

            //First Approach
            PdfFileEditor pdfEditor = new PdfFileEditor();
            return pdfEditor.Concatenate(input, outputStream);
        <SPAN style="COLOR: green">//Second Approach</SPAN>
        Aspose.Pdf.<SPAN style="COLOR: #2b91af">Document</SPAN> mainDoc = <SPAN style="COLOR: blue">new</SPAN> Aspose.Pdf.<SPAN style="COLOR: #2b91af">Document</SPAN>();
        <SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">Stream</SPAN> st <SPAN style="COLOR: blue">in</SPAN> inputStreams)
        {
            Aspose.Pdf.<SPAN style="COLOR: #2b91af">Document</SPAN> insideDoc = <SPAN style="COLOR: blue">new</SPAN> Aspose.Pdf.<SPAN style="COLOR: #2b91af">Document</SPAN>(st);
            mainDoc.Pages.Add(insideDoc.Pages);
        }</PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"> </PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"> </PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px">Also,as mentioned in the technical artical below on this website where is the FileProcessingStrategy in Aspose.PDf, </PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px">i think it was available only in Pdf kit. </PRE><PRE style="FONT-FAMILY: Consolas; BACKGROUND: white; COLOR: black; FONT-SIZE: 13px"><A href="http://www.aspose.com/documentation/.net-components/aspose.pdf.kit-for-.net/concatenate-improve-performance-and-optimize-memory-utilization.html">http://www.aspose.com/documentation/.net-components/aspose.pdf.kit-for-.net/concatenate-improve-performance-and-optimize-memory-utilization.html</A> <BR>So how do we optimize the concatination operation in Aspose.PDF</PRE></SPAN></PRE>

Hi,

Thanks for using our products.

There are two approaches to manipulate existing PDF doucments. You can use Aspose.Pdf namespace or you can use Aspose.Pdf.Facades namespace to manipulate the PDF documents. Please try using either approach and in case you encounter any problem or observer that the performance is not as per your requirement, please feel free to contact.

You can use the code specified over Concatenate: Improve Performance and Optimize Memory Utilization location and the only change you need make it to update the class reference from Aspose.Pdf.Kit to Aspose.Pdf.Facades when using with Aspose.Pdf for .NET.