*NIX Tricks

[cli] Combine or remove pages from a PDF document using ghostscript

Posted in cli by kousik on September 1, 2009

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.

Advertisement
Tagged with: , , , ,

2 Responses

Subscribe to comments with RSS.

  1. [...] (If you’re at playing with PDFs you may also be interested in joining and removing pages from a PDF document using Ghostscript — see a previous post here) [...]

  2. [...] [...]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.