Skip to content

Instantly share code, notes, and snippets.

@xbns
Last active August 9, 2021 11:00
Show Gist options
  • Save xbns/1fda5db27c000d9d785fbd8e57e90e07 to your computer and use it in GitHub Desktop.
Save xbns/1fda5db27c000d9d785fbd8e57e90e07 to your computer and use it in GitHub Desktop.
#ghostscript #pdf

Installation

https://www.ghostscript.com/download/gsdnld.html

Add Ghoscript in PATH

Windows

Advanced System Settings -> Environment Variables

System Variables -> New

Variable:GHOSTSCRIPT_HOME Value:C:\Program Files\gs\gs9.54.0

Select Path system Variable

System Variables -> Edit

Add New

%GHOSTSCRIPT_HOME%\bin

Click OK

Linux

Added automatically when using sudo apt-get install ghostscript or Arch

Confirm Installation added to Path

$ gswin64c --version
9.54.0

Merges PDFs

Linux

$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=merged.pdf -dBATCH 1.pdf 2.pdf

Windows

$ gswin64c -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combined.pdf -dBATCH 1.pdf 2.pdf

Alternative

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

$ pdftk.exe *.pdf output combined.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment