Issue

Multiple single/multi page PDF files should be merged into one multi page PDF file


Solution

The Pdfsharp library allows you to do many different operations on PDF files. As it is a .NET library you can use it without any issues within Powershell. In the attached cO.Pdfsharp.zip you will find a psm1 file and the PdfSharp-gdi.dll in version 1.5.4000. The MergePdf function in the module demonstrates 

- How to load the library in Powershell

- How to make a new PDF with Pdfsharp

- How to open existing files with Pdfsharp

- How to add pages of existing PDFs to another PDF

- How to save a PDF with Pdfsharp


You'll find links to the Pdfsharp source code on their website. If you don't want to compile it yourself you can grab a compiled assembly from nuget.

See Also