, , , ,

Combine pdf files:

$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf pdffile1.pdf pdffile2.pdf

which combines pdffile1.pdf and pdffile2.pdf into a single ouput.pdf.

Delete certain pages of a PDF document:

$ gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=m -dLastPage=n -sOutputFile=output.pdf input.pdf

where m and n are positive integers (page numbers), i.e. the above command only prints out pages starting from page number m through n of input.pdf into output.pdf.