What tool is best for removing pages from a PDF?
I have a set of PDF documents that each have a few extra pages. I'd like to remove the first two and last pages from each of them. Preview only lets me look at and annotate a PDF, not edit one. Can anyone recommend a (free/freeware) tool to do this? I'm using 10.5 PPC so that does limit some of my options. Command line or GUI is fine.
Ok, in Preview it seems I can delete pages by hitting ⌘⌫ on the thumbnails, but it will then not give me the option to save. I can then try printing the altered document to PDF, but I am leery of this because I don't want to loose any metadata (I have to double-check all the files to see how much metadata there is if I decide on this course).
Just tried Acrobat at work, that doesn't work. The files are mod-protected by a password.
Solution 1:
For the command-line I can recommend:
pdftk, the PDF Toolkit (for the Snow-Leopard installer you can try Pacifist to get the binaries or use the older version)
Merge PDF Documents
Split PDF Pages into a New Document
Rotate PDF Pages or Documents
…
If your PDF is edit-protected, you may want to try qpdf (via e.g. homebrew) to remove the restrictions first.
QPDF is a command-line program that does structural, content-preserving transformations on PDF files. It could have been called something like pdf-to-pdf. It also provides many useful capabilities to developers of PDF-producing software or for people who just want to look at the innards of a PDF file to learn more about how they work.
Solution 2:
Preview can selectively export pages of a PDF through the printing options. I just download IRS form W9, which has four pages. The first page is the form that needs to be filled out, and the final three pages are instructions. I filled out the first page using Preview on Mountain Lion, then I chose to print. From the print screen, I chose to include only one page (the first page), and saved to PDF with the button at the bottom of the print sheet. This technique can be used for individual pages or a range of pages.
Solution 3:
As I have written before, QPDF is great. Use it this way to extract pages 3-998 from 1000 pages of input.pdf
and save it as output.pdf
.
qpdf --pages input.pdf 3-998 -- input.pdf output.pdf
Please note that input.pdf
is written twice.
You can install as described here:
Download MacPorts and invoke:
sudo port install qpdf
Or you can install it with Homebrew:
brew install qpdf
It is a great tool for PDF manipulation, which is very fast, has very few dependencies. "It can encrypt and linearize files, expose the internals of a PDF file, and do many other operations useful to end users and PDF developers."
http://sourceforge.net/projects/qpdf/
It can work with password protected files. For example:
qpdf --empty --copy-encryption=encrypted.pdf --encryption-file-password=pass
--pages encrypted.pdf --password=pass 1 ./encrypted.pdf --password=pass 1 --
outfile.pdf
Solution 4:
PDFpen from Smile Software is a commercial program that can do this and much more. The latest version for Lion is PDFpen 5.8, but you can purchase a copy of their older version 4.7.1, which is compatible with 10.5 Leopard.