QPDF is great. Use it this way to extract pages 1 to 10 from input.pdf
and save it as output.pdf
:
qpdf input.pdf --pages . 1-10 -- output.pdf
This preserves all metadata associated with that file.
From the old manual:
If you wanted pages 1 through 5 from infile.pdf but you wanted the rest of the metadata to be dropped, you could instead run
qpdf --empty --pages infile.pdf 1-5 -- outfile.pdf
Here's a link to the current documentation, giving more examples of page selection.
You can install it by invoking:
sudo apt-get install qpdf
It is a great tool for PDF manipulation. It's very fast and has very few dependencies. From QPDF's GitHub repo:
QPDF is a command-line tool and C++ library that performs content-preserving transformations on PDF files. It supports linearization, encryption, and numerous other features. It can also be used for splitting and merging files, creating PDF files (but you have to supply all the content yourself), and inspecting files for study or analysis.