Removing the Last Page from a PDF

A customer recently asked how to do this. The Coherent PDF Tools page specification doesn’t directly allow it, but we can do it indirectly:

  1. Reverse the document’s pages using the ‘reverse’ page specification
  2. Use the page specification ‘2-end’ to remove the first page
  3. Reverse the document again
You can use the ‘AND’ construction to string these together in a single command, avoiding processing the file multiple times:

cpdf in.pdf reverse AND -range 2-end AND -range reverse -o out.pdf

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *