Merge or Combine Multiple PDFs in UWP

The following example demonstrates how to append one document to another:

// Create a job from a source document.
var job = new PSPDFKit.Document.Editor.Job(_documentOne);

// For every page in a second source document, make a new page and add it to the job.
var docOnePageCount = await _documentOne.GetTotalPageCountAsync();
var docTwoPageCount = await _documentTwo.GetTotalPageCountAsync();
for (var pageIndex = 0; pageIndex < docTwoPageCount; pageIndex++ )
{
    // Create a new page from the second document at the page index.
    var newPage = NewPage.FromPage(_documentTwo, pageIndex);

    // Append it to your job's document.
    await job.AddPageAtIndexAsync(newPage, docOnePageCount + pageIndex);
}

// Create a new PDF and get its `StorageFile`.
var newDocument = await Editor.NewStorageFileFromJobAsync(job);

It’s also possible insert specific pages from one or more other documents into the source document. The following example inserts page 3 from a second document into the source document at page 6:

// Create a job from a source document.
var job = new PSPDFKit.Document.Editor.Job(_documentOne);

// Create a new page from a second document at page index 2.
var newPage = NewPage.FromPage(_documentTwo, 2);

// Append the new page to your job's document at page index 5.
await job.AddPageAtIndexAsync(newPage, 5);

// Create a new PDF and get its `StorageFile`.
var newDocument = await Editor.NewStorageFileFromJobAsync(job);