bim-pdf

Work with PDFs your way — split a combined sheet export into individual files, shrink a set before sending to a client, extract element data for a takeoff, or embed structured data for archiving. If you've ever gotten garbled text or wrong element IDs from a PDF tool on a Revit export, it's because most tools don't understand how Revit encodes its output. bim-pdf does.

PDF analysis and manipulation for AEC workflows. Zero dependencies — handles Revit's specific PDF encoding natively.

Revit PDF specifics

Revit exports PDFs with Adobe PDF Library 18.0.5 (PDF 1.6). Every visible element is wrapped in a BMC/BDC tagged content block encoding its ElementId. Text uses Type0 Identity-H encoding — standard extractors return garbage. bim pdf marked and bim pdf text handle both correctly.

Verbs

VerbWhat it does
bim pdf info FILEMetadata, page count, PDF version, XMP namespace map, and embedded attachments. Includes the same attachment list returned by attach.list; for PDF-BIM packages that attachment set also matches bim.list.
bim pdf pages FILE [--detail]Per-page dimensions and OCG layer list. Default: fast path using pdfium for MediaBox/Rotation only. Use --detail for custom page-dict entries and layer visibility (slower on large vector sets).
bim pdf marked FILE [--page N] [--tag TAG]Extract BMC/BDC tagged content blocks with geometry bounds. Omit --page to process every page in one call.
bim pdf text FILE [--page N] [--lines]Text extraction; decodes via ToUnicode CMap. Omit --page to process every page in one call. Default output: per-word tokens with x/y/fontSize coordinates. With --lines: assemble tokens into reading-order text lines per page (group by Y, sort by X) -- equivalent to pdftotext -layout / pdfplumber extract_text().
bim pdf extract FILE [--field FIELD] [--all] [--page N]Extract named field values from PDF reading-order lines using regex capture groups. Each --field is NAME=REGEX where the first capture group is the value. Accepts a single file path or a glob pattern for batch processing. Default output: one summary per file with first match per field. With --all: every per-line match.
bim pdf table FILE [--page N]Extract row/column-structured text from each page. Omit --page to process every page in one call. Detects column boundaries from run X positions and returns [{page, rows:[{cells:[...]}]}]. Useful for holdings tables, statement grids, and tabular data without bespoke parsing.
bim pdf search FILE PATTERN [--literal] [--page N] [--pages PAGES] [--context N] [--with-runs] [--with-line] [--max N] [--font FONT] [--min-size MIN-SIZE] [--max-size MAX-SIZE]Search text in a PDF using a regexp pattern; returns matches with bboxes
bim pdf optimize FILE [--out FILE]Optimize PDF size and structure
bim pdf render FILE [--out-dir FILE] [--page N] [--format FORMAT] [--dpi N] [--bbox BBOX] [--out FILE]Render pages to images using pdfium (bundled, no Ghostscript required). Falls back to Ghostscript if pdfium renderer is unavailable. --bbox crops a single page region and requires --page.
bim pdf enrich FILE SIDECAR [--tag-pattern TAG-PATTERN] [--id-field ID-FIELD]Join `marked` output with a sidecar JSON lookup table
bim pdf package FILE METADATA [--out FILE] [--no-marks]Embed metadata files as PDF/A-3 attachments — produces a PDF–BIM Package
bim pdf viewer FILE [--port N] [--colors FILE] [--agent-color AGENT-COLOR] [--require-data]Local browser viewer for PDF–BIM packages; writes startup response then blocks
bim pdf report [--template TEMPLATE] [--data FILE] [--flood-map FILE] [--school-map FILE] [--parcel-map FILE] --out FILE [--timeout TIMEOUT]Generate a graphical PDF site assessment report
bim pdf doctorDriver health check
bim pdf versionDriver version

annot

VerbWhat it does
bim pdf annot.list FILE [--page N]List all annotations
bim pdf annot.remove FILE [--page N] [--type TYPE] [--out FILE]Remove annotations
bim pdf annot.bake FILE --scene FILE [--out FILE]Write /Annot dicts + Named Destinations from a scene JSON into a new PDF
bim pdf annot.export-xfdf SCENE [--out FILE]Export scene annotations to XFDF (importable in Bluebeam / Acrobat)

attach

VerbWhat it does
bim pdf attach.list FILEList embedded attachments. The same names already appear in info under attachments; for PDF-BIM packages this returns the same set as bim.list.
bim pdf attach.extract FILE [--out FILE] [--out-dir FILE]Extract attachments to a directory; use --out <dir> (--out-dir accepted as a legacy alias)
bim pdf attach.add FILE ATTACHMENT [--out FILE]Embed a file as an attachment; uses --out because exactly one PDF is written
bim pdf attach.remove FILE --name NAME [--out FILE]Remove an attachment by name

bookmark

VerbWhat it does
bim pdf bookmark.list FILEList all bookmarks
bim pdf bookmark.export FILE [--out FILE]Export bookmarks to JSON
bim pdf bookmark.import FILE BOOKMARKS-JSON [--out FILE]Import bookmarks from JSON

form

VerbWhat it does
bim pdf form.fields FILEList all form fields
bim pdf form.fill FILE DATA-JSON [--out FILE]Fill form fields from a JSON data file
bim pdf form.flatten FILE [--out FILE]Flatten form fields (make non-editable)

page

VerbWhat it does
bim pdf page.merge --files FILE --out FILE [--no-bookmarks]Merge multiple PDFs into one; inserts a top-level bookmark for each source file by default; falls back to Ghostscript if pdfcpu cannot parse an input
bim pdf page.split FILE [--out-dir FILE] [--span N] [--by-bookmark]Split a PDF into individual pages or spans; --by-bookmark splits at top-level bookmark boundaries (ignores --span)
bim pdf page.collect FILE --pages PAGES [--out FILE]Extract specific pages into a new PDF
bim pdf page.rotate FILE --degrees N [--pages PAGES] [--out FILE]Rotate pages by 90, 180, or 270 degrees
bim pdf page.crop FILE --box BOX [--out FILE]Crop pages to a bounding box; negative coords supported (Revit PDFs use a centered origin — use -- to separate flags from negative values, e.g. page crop -- --box -785,-123,-348,195 in.pdf)

security

VerbWhat it does
bim pdf security.encrypt FILE [--user-password USER-PASSWORD] [--owner-password OWNER-PASSWORD] [--out FILE]Encrypt with user and owner passwords
bim pdf security.decrypt FILE [--password PASSWORD] [--out FILE]Remove encryption

stamp

VerbWhat it does
bim pdf stamp.add FILE [--text TEXT] [--image FILE] [--font FONT] [--points N] [--scale SCALE] [--color COLOR] [--opacity OPACITY] [--rotation ROTATION] [--page N] [--position POSITION] [--x X] [--y Y] [--width WIDTH] [--height HEIGHT] [--out FILE]Add a text or image watermark; supply either --text or --image, not both
bim pdf stamp.remove FILE [--out FILE]Remove all watermarks/stamps

scene

VerbWhat it does
bim pdf scene.save FILE [--out FILE]Save a minimal empty scene file for a PDF (use session.save in viewer for live sessions)

bim

VerbWhat it does
bim pdf bim.validate FILEValidate PDF–BIM package structure
bim pdf bim.pack FILE SIDECAR [--out FILE]Embed sidecar JSON files into a PDF as PDF/A-3 attachments — produces a PDF-BIM package
bim pdf bim.list FILEList all sidecar files embedded in a PDF-BIM package. For PDF-BIM packages this is the same set returned by attach.list and by info.attachments.
bim pdf bim.extract FILE --name NAME [--out FILE]Extract a named sidecar from a PDF-BIM package and return its JSON content
bim pdf bim.extract-titleblock FILEExtract title block fields (sheet number, name, project, date, scale, revision) from a PDF-BIM package
bim pdf bim.extract-room-schedule FILEExtract room elements (class=room) from a PDF-BIM package as a structured room schedule

For agent use: /pdf/llms.txt

Guides