last updated 2012-09
merging PDF files using GhostScript
to merge several files file1.pdf, file2.pdf, … into a single output.pdf file, use
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=output.pdf -dBATCH file1.pdf file2.pdf ...
the -dNOPAUSE simply means that gs won't stop along the way to ask you questions, like "do you want to continue?"
cutting PDF files using GhostScript
to get only pages 50-60 of a document, use
gs -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=my_cut_file.pdf -dFirstPage=50 -dLastPage=60 -dBATCH my_file.pdf
converting to PDF using GhostScript
you can convert a vast array of documents into PDF using gs; to convert PostScript to PDF, use
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=output.pdf -dBATCH my_file.ps
GhostScript actually supports an incredible array of formats; to check what all you can work with, just run
echo 'devicenames == ' | gs -q | tr " " "\n" | sort