poppler (pdftotext / pdftoppm)

CLI

PDF text extraction, page info, and PDF → PNG rendering. The reliable way to read PDFs from a shell.

Extract text from a PDF or render pages to PNG without ImageMagick policy problems

6 of 6 recipes verified by execution · 2026-09-17#pdf#text#extract#png#image#convert#render

Verified commands

Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.

Extract text from a PDF to stdout (keep layout)

Verified macOS · Linux · 2026-09-17
pdftotext -layout input.pdf -
Common failures (1)
  • empty outputthe PDF is scanned images with no text layer: render pages with pdftoppm and run OCR (tesseract)

Extract text from a PDF to a file

Verified macOS · Linux · 2026-09-17
pdftotext input.pdf output.txt

Extract text from a page range

Verified macOS · Linux · 2026-09-17
pdftotext -f 1 -l 1 input.pdf -

Show page count and metadata

Verified macOS · Linux · 2026-09-17
pdfinfo input.pdf

Render every page to PNG (page-1.png, page-2.png, …)

Verified macOS · Linux · 2026-09-17
pdftoppm -r 150 -png input.pdf page
Common failures (1)
  • ImageMagick 'convert' fails with a security policy errorpdftoppm does not go through ImageMagick's policy.xml; use it instead of convert on Debian/Ubuntu

Render only the first page to a single PNG

Verified macOS · Linux · 2026-09-17
pdftoppm -r 150 -png -f 1 -l 1 -singlefile input.pdf first

Install

Homebrewbrew install poppler
aptsudo apt install poppler-utils

Agent notes

When to use
Reading a spec/paper PDF the user shared, or turning PDF pages into images for a vision model
Quick examples
  • pdftotext -layout doc.pdf -
  • pdftoppm -r 150 -png doc.pdf page

Use from an agent

curl -s https://clihub.com/api/tools/poppler | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug poppler on the MCP server at https://clihub.com/mcp.

Homepage ↗GPL-2.00 views