PDF: Merge multiple PDF Files

Hi,

the Standard PDF Viewer Adobe Acrobat Reader has no edit function, therefore a merge of multiple pdf files is also not possible.

One Option is to buy a tool like Adobe Acrobat Standard or use the free tool ghostscript. Ghostscript has command line interface and is included in all versions of Linux and can also be Ghostscript for Windows.

On linux Install ghostscript with your favorite package package manager

root@debdev ~ # apt-get install ghostscript

For Windows download the installation package and start the setup program.

For merging files on Windows set GS_FONTPATH to the Windows font directory. Otherwise you get an error that some fonts were not found and your font is substituted with another one:

Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Helvetica for ArialMT.

Set GS_FONTPATH

C:\> set GS_FONTPATH=C:\Windows\Fonts

and execute ghostscript

D:\> cd FolderOfYourPDFFiles
D:\FolderOfYourPDFFiles> D:\Ghostscript\x64\gs9.07\bin\gswin64c.exe -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=D:\temp\Merged.pdf -dBATCH PDFFile1.pdf PDFFile2.pdf PDFFilen.pdf

On Linux the ghostscript command line utility is simply gs

michael@debdev ~ # gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=/tmp/Merged.pdf -dBATCH PDFFile1.pdf PDFFile2.pdf PDFFilen.pdf

Michael

Leave a Reply