

Merge ( finalDoc, mergeOptions, streams ) //Save the document into stream. Stream streams = PdfMergeOptions mergeOptions = new PdfMergeOptions () //Enable the Extend Margin. Read ) //Create a PDF stream for merging. Read ) FileStream stream2 = new FileStream ( "file2.pdf", FileMode. FileStream stream1 = new FileStream ( "file1.pdf", FileMode. Margins = margin //Load the PDF document. PdfMargins margin = new PdfMargins () margin. PdfDocument finalDoc = new PdfDocument () //Create new instance for the document margin.
#MERGE PDF MULTIPLE FILES CODE#
However, you can optimize PDF resources when merging multiple documents from a stream using the following code snippet. Due to platform limitations, the PDF file cannot be loaded from disk. The following code snippet explains this. You can split a large PDF document into multiple documents using Split method of PdfLoadedDocument class. It releases the memory once the final PDF document instance is disposed.

Four steps to merge multiple PDF pages: Click Browse button. Note: The parent PDF document has all the contents in run time memory. If you want to splice multiple PDF documents into one document, please use the PDF document merge. This method avoids the extensive memory usage and increases the performance. So, you can split the documents into multiple documents and later you can merge. Merging multiple large PDF documents can lead to high runtime memory. You can download a complete working sample from GitHub. Save ( "sample.pdf" ) 'Closes the documents document. ImportPage ( lDoc2, 1 ) 'Saves the document document. 'Loads a document Dim lDoc As New PdfLoadedDocument ( "file1.pdf" ) Dim lDoc2 As New PdfLoadedDocument ( "file2.pdf" ) 'create a new document Dim document As New PdfDocument () 'imports and arranges the pages document.
