borb is a Python package to read, write, and edit PDFs using a JSON-like document model, with layout helpers and optional add-ons for OCR, Markdown, and redaction.
Overview
borb is a Python library focused on practical PDF workflows: creating documents, reading existing files, and changing content without hand-writing low-level PDF syntax. Internally it represents PDF structure with nested lists, dictionaries, and primitive values, which keeps generation and manipulation approachable for automation.
Typical capabilities include metadata handling, text and image extraction, annotations, and layout via page layout primitives so paragraphs, tables, lists, and images can be appended in code. It integrates with common Python imaging and plotting stacks when charts or raster assets are needed.
Install is via pip for use inside applications and scripts. Optional add-ons extend the core with find-and-replace, Markdown-to-PDF conversion, OCR for scanned pages, and standards-oriented redaction using PDF redact annotations and rule-driven classifiers.
Licensing is dual AGPL plus a commercial option when closed-source distribution or paid PDF services apply; users should evaluate licence terms for their deployment model.
Key features
- Read, write, and manipulate PDFs in Python
- PageLayout for text, tables, and images
- Metadata read and edit
- Text and image extraction
- PDF annotations
- Matplotlib and PIL compatibility
- Optional Markdown, OCR, redaction add-ons
- pip-installable package
Use cases
- Automated invoice and report PDFs
- Contract and document generation
- Batch PDF content updates
- Documentation pipelines from Markdown