Quick Linux Tip #68:
Question: How do I split or extract pages from a PDF without a GUI?
Try: pdftk input.pdf cat 5-10 output pages_5_to_10.pdf
Info: pdftk manipulates PDFs from the command line. cat 5-10 extracts pages 5 through 10, while pdfinfo can inspect PDF metadata and page counts.
Examples:
- $
pdftk file1.pdf file2.pdf cat output merged.pdf# Merge multiple PDFs - $
pdftk input.pdf cat 1 3 5-10 output selected.pdf# Extract custom page ranges - $
qpdf --empty --pages input.pdf 1-5 -- output.pdf# Use qpdf as a modern alternative
Note: Install pdftk with sudo apt install pdftk-java. Use end to target the final page, such as cat 5-end. qpdf is another useful command-line PDF tool.
Leave a Reply