Extract PDF metadata, such as chapters and bookmarks, into a text file:
pdftk input.pdf dump_data output metadata.txt
Embed PDF metadata as text into a PDF:
pdftk input.pdf update_info metadata.txt output output.pdf
To remove pages and page ranges from a PDF, use pdftk
to:
pdftk input.pdf cat 2-end output output.pdf
The above command will not preserve metadata, though.