Manipulating PDFs from the Unix Command Line

Poppler Utilities

The Poppler utilities provide many Unix command-line tools for manipulating PDFs. Install via:

  • sudo apt-get install poppler-utils (Ubuntu)
  • sudo apk add poppler-utils (Alpine)
  • brew install poppler (macOS)

Extract Text from a PDF

1
pdftotext input.pdf output.txt

Merge PDFs Together

1
pdfunite file1.pdf file2.pdf merged.pdf

Split (Extract) Pages from a PDF

This will split each page of input.pdf to output_1.pdf, output_2.pdf, etc.

1
pdfseparate input.pdf output_%d.pdf

Convert SVG to PDF

Using inkscape

Inkscape is a powerful SVG editor with command-line support.

You can convert SVG to PDF like this:

1
inkscape input.svg --export-type=pdf --export-filename=output.pdf

Using rsvg-convert (from the librsvg package)

1
rsvg-convert -f pdf -o output.pdf input.svg

Manipulating PDFs from the Unix Command Line
https://jifengwu2k.github.io/2025/08/27/Manipulating-PDFs-from-the-Unix-Command-Line/
Author
Jifeng Wu
Posted on
August 27, 2025
Licensed under