pdfboss.dev

Command line

PDF to text, Markdown and PNG from the terminal.

One binary, twenty subcommands. pdfboss converts, inspects, edits 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
mergeSelected pages from several inputs into one fresh document
splitCut a document into consecutive chunks of pages
rotateRotate selected pages by a quarter turn
overlayDraw the first page of another PDF onto every page, over or under the content
metaSet title, author, subject, keywords, creator or producer
rewriteWrite the document fresh, recompressed, without unreachable objects
encryptAES-256 protect a fresh copy with user and owner passwords
decryptRemove encryption, writing a plain copy
skillInstall or print the bundled Claude Code skill

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

Edit

Merge, split, rotate, overlay, encrypt.

rotate, overlay and meta append an incremental update by default, so the original bytes stay in the file; --rewrite writes the document fresh instead. merge, split, rewrite, encrypt and decrypt always write a fresh file. Encrypted inputs open with --password.

edit
$ pdfboss merge q1.pdf q2.pdf -o h1.pdf
$ pdfboss split h1.pdf -o part-%d.pdf --every 10
$ pdfboss rotate scan.pdf -o upright.pdf --by 90 --pages 2,4-9
$ pdfboss overlay report.pdf draft.pdf -o stamped.pdf --under
$ pdfboss meta report.pdf -o report-2.pdf --set title="Q3 Report"
$ pdfboss encrypt report.pdf -o locked.pdf --user-password s3cret
$ pdfboss decrypt locked.pdf -o report.pdf --password s3cret
$ pdfboss rewrite old.pdf -o compact.pdf      # drop unreachable objects and old updates

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