Tip: concatenating PDF files with Ghostscript

Posted on . Updated on .

A small tip mostly used as a reminder to myself. Ghostscript can be used to concatenate PDF files the following way.

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH \
	-sOutputFile=output.pdf \
	input1.pdf \
	input2.pdf \
	input3.pdf
  • The sDEVICE option tells gs to generate a PDF instead of sending the output to the printer.

  • The dNOPAUSE and dBATCH options tell gs to be noninteractive.

  • The sOutputFile option does the obvious.

  • The positional arguments are the input files.

Load comments