Merge PDFs
From Supporting Role Wiki
Jump to navigationJump to search
Ways of combining / merging PDF's on Forget ABout IT servers:
Using CUPS
This method is quickest and simplest, and puts the output file into the user's PDF folder.
sudo lp -d PDF -U <USERNAME> File01.pdf File02.pdf File03.pdf ...
However, I have found that this doesn't work with some "less than perfect" PDF files
Using GhostScript
To use Ghostscript to combine PDF files, type something like the following:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf File01.pdf File02.pdf ...
Unless you're very familiar with Ghostscript, that string of commands won't mean much to you. Here's a quick breakdown:
- \tgs -- starts the Ghostscript program
- \t-dBATCH -- once Ghostscript processes the PDF files, it should exit. If you don't include this option, Ghostscript will just keep running
- \t-dNOPAUSE -- forces Ghostscript to process each page without pausing for user interaction
- \t-q -- stops Ghostscript from displaying messages while it works
- \t-sDEVICE=pdfwrite -- tells Ghostscript to use its built-in PDF writer to process the files
- \t-sOutputFile=finished.pdf -- tells Ghostscript to save the combined PDF file with the name that you specified