pdfboss.dev

Command line

PDF to text, Markdown and PNG from the terminal.

One binary, eleven subcommands. pdfboss converts, inspects and creates PDFs, takes a local path or an http(s) URL for anything it reads, and reports what it had to skip instead of failing silently. Installed from crates.io, MIT OR Apache-2.0.

$cargo install pdfboss-cliSubstitute fonts and the CJK CMap set are bundled by default; --no-default-features for a leaner binary.

Convert

Text, Markdown, PNG and images.

render prints what it wrote and warns on stderr about anything dropped; images names every file it writes. Page numbers are 1-based on the command line.

~/reports
$ pdfboss info report.pdf                     # version, page count, sizes, metadata
$ pdfboss text report.pdf --page 2            # PDF to text (omit --page for all pages)
$ pdfboss md report.pdf > report.md           # PDF to Markdown: headings, lists, tables
$ pdfboss render report.pdf --page 1 -o page.png --scale 2.0   # or .ppm / .bmp / .jpg
$ pdfboss images report.pdf -o out/           # embedded images as native-size PNGs

Subcommands

Everything the binary does.

infoVersion, page count, page sizes and metadata
textExtract plain text, all pages or one
mdExtract Markdown with headings, lists and tables from layout
renderRasterize a page to PNG, PPM, BMP or JPEG at a scale
imagesWrite every embedded image on a page at native size
objPrint one object by number
jsonThe whole document as a JSON element tree
hexHexdump of any object, xref section or byte range
qjq-style queries over the element tree
tuiThe terminal explorer
createblank, text, images, md or a TOML manifest to a new PDF

Encrypted files open with --password. Full flags per subcommand in the CLI reference.

Explore

See inside any PDF, local or remote.

tui opens the file as a lazy tree: pages with their fonts, images and content streams, a pretty-printing inspector, a live page preview and a tracking hexdump. The same element model answers json, q and hex.

pdfboss tui quarterly.pdf
The pdfboss terminal explorer: an element tree with a page's fonts expanded, a rasterized page preview, and a hexdump of the selected object's decoded bytes
explore
# fetched in byte ranges, never downloaded whole
$ pdfboss json https://example.com/report.pdf --no-logical > tree.json
$ pdfboss q https://example.com/report.pdf -r '.pages[].fonts[].base_font'
$ pdfboss hex report.pdf header
$ pdfboss tui https://example.com/report.pdf

Create

New PDFs from text, images, Markdown or a manifest.

create md composes CommonMark+GFM with a CSS theme; create manifest assembles pages, metadata, bookmarks and attachments from one TOML file. Output is deterministic.

create
$ pdfboss create blank -o blank.pdf --pages 3 --size letter
$ pdfboss create text notes.txt -o notes.pdf --font times-roman
$ pdfboss create images scan-1.png scan-2.png -o scans.pdf
$ pdfboss create md notes.md -o notes.pdf --theme theme.css
$ pdfboss create manifest q3.toml -o q3.pdf