How to remove the first or last page of a .pdf using a Mac

I needed to remove the first and last pages of a hold lot of .pdf files on a Mac. It wasn’t that easy to find solutions and so I thought I would document the process:

1 – Install pdftk server which rather helpfully has a Mac installer:

https://www.pdflabs.com/tools/pdftk-server/

Run the commands
To remove the first page of all the .pdf files in a directory use this command:

for i in *pdf ; do pdftk $i cat 2-end output output/$i ; done

To remove the last page of all the .pdf files in a folder use this command:

for i in *pdf ; do pdftk $i cat 1-r2 output trimmed/$i ; done

Hope this helps someone.

One thought to “How to remove the first or last page of a .pdf using a Mac”

  1. Hi. This is not working for me. It creates only the first pdf file in the output folder and the pdf create is a blank file (zero bytes). Any idea why this isn’t working for me?

Leave a Reply to F Cancel reply