poppler (pdftotext / pdftoppm)
CLIPDF 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
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)
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
pdftotext input.pdf output.txtExtract text from a page range
pdftotext -f 1 -l 1 input.pdf -Show page count and metadata
pdfinfo input.pdfRender every page to PNG (page-1.png, page-2.png, …)
pdftoppm -r 150 -png input.pdf pageCommon 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
pdftoppm -r 150 -png -f 1 -l 1 -singlefile input.pdf firstInstall
Homebrew
brew install popplerapt
sudo apt install poppler-utilsAgent 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.