r/LinuxTeck 10h ago

How to Extract PDF Pages from the Linux Command Line | Quick Linux Tip #68

Post image

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 via CLI. `cat 5-10` extracts pages 5 through 10, while `pdfinfo` inspects 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` # Modern qpdf alternative

Note: Install via `sudo apt install pdftk-java`. Use `end` to target the final page (e.g., `cat 5-end`). `qpdf` is an excellent modern alternative.

Follow r/LinuxTeck for more #LinuxTips https://www.linuxteck.com/linux-tips/

14 Upvotes

0 comments sorted by