Project

PSWritePDF

PowerShell Module to create, edit, split, merge PDF files on Windows / Linux and MacOS

Stars227
Forks23
Open issues20
PowerShell Gallery downloads545189
Releasev0.0.20
Language: C# Updated: 2026-04-11T10:19:10.0000000+00:00

Curated Examples

Merge PDF files

Use PSWritePDF to merge existing PDF files from a PowerShell workflow.

This pattern is useful when a process produces separate PDF artifacts that need to be combined.

It comes from the source example at Example/Example03.Merging/Example03.ps1.

When to use this pattern

  • You receive multiple PDFs from upstream steps.
  • The output should be one merged document.
  • You want the merge step to be scriptable.

Example

Import-Module .\PSWritePDF.psd1 -Force

$inputFiles = @(
    "$PSScriptRoot\Input\OutputDocument0.pdf"
    "$PSScriptRoot\Input\OutputDocument1.pdf"
)
$outputFile = "$PSScriptRoot\Output\OutputDocument.pdf"

Merge-PDF -InputFile $inputFiles -OutputFile $outputFile -Verbose

What this demonstrates

  • using an array of input files
  • writing a deterministic output path
  • adding PDF merge to a larger automation

Source