

ImportPage ( lDoc2, 1 ) //Save the PDF document to stream MemoryStream stream = new MemoryStream () await document. GetManifestResourceStream ( "2.pdf" ) //Creates an empty PDF loaded document instance PdfLoadedDocument lDoc2 = new PdfLoadedDocument ( pdfStream2 ) //Creates the new document PdfDocument document = new PdfDocument () //Imports and arranges the pages document. GetManifestResourceStream ( "1.pdf" ) //Creates an empty PDF loaded document instance PdfLoadedDocument lDoc = new PdfLoadedDocument ( pdfStream1 ) //Load the PDF document as stream Stream pdfStream2 = typeof ( MainPage ).

Load the PDF document as stream Stream pdfStream1 = typeof ( MainPage ).
#COMBINE PDF FILES CODE#
The following code example explains the same. You can also import pages from multiple documents and arrange the pages as required.
#COMBINE PDF FILES DOWNLOAD#
You can download a complete working sample from GitHub. Read ) // Creates a PDF stream for merging Stream streams = Read ) FileStream stream2 = new FileStream ( "file2.pdf", FileMode. Creates a PDF document PdfDocument finalDoc = new PdfDocument () FileStream stream1 = new FileStream ( "file1.pdf", FileMode. However, you can merge multiple documents from stream using the following code snippet. Due to platform limitations, the PDF file cannot be loaded from disk. Refer to PDF/UWP section for respective code samples Save ( stream, "Sample.pdf" ) Close ( true ) //Save the stream as PDF document file in local machine. SaveAsync ( stream ) //Close the documents document. Merge ( document, loadedDocument ) //Save the PDF document to stream MemoryStream stream = new MemoryStream () await document. OpenAsync ( file ) //Create a new PDF document PdfDocument document = new PdfDocument () //Merge the document PdfDocumentBase. PickSingleFileAsync () //Creates an empty PDF loaded document instance PdfLoadedDocument loadedDocument = new PdfLoadedDocument () //Loads or opens an existing PDF document through Open method of PdfLoadedDocument class await loadedDocument. Add ( ".pdf" ) //Browse and choose the file StorageFile file = await picker. Create the file open picker var picker = new FileOpenPicker () picker. However, you can merge specified document using the following code snippet.

