A simple Ghostscript command to merge two PDFs in a single file is shown below:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf
Install Ghostscript:
Type the command sudo apt-get install ghostscript
to download and install the ghostscript package and all of the packages it depends on.
I added this to a function in my
.zshrc
(or.bash_profile
for *nix) for easier use.Then you can just run
Which will output the combined pdfs to a file called
file1___file2.pdf
Inspired by this gist which is using ghostscript to compress a pdf.