Library / SDK
borb-pdf/borb avatar
borb-pdf/borb

borb: a pure Python PDF library with a JSON-like document model

borb is a library for reading, creating and manipulating PDF files in python.

3,587 stars160 forksPythonNOASSERTION

At a glance

What is it?
borb reads, writes and manipulates PDF files in Python by modelling the document as nested lists and dictionaries. It installs from PyPI, ships a single-column layout helper, and is dual-licensed under AGPL or a paid commercial licence.
Who is it for?
borb suits Python developers who want to generate or edit PDFs programmatically and can live with AGPL terms or buy the commercial licence. It is the wrong choice for closed-source products that will not pay, and for anyone who needs a PDF parser that reports positions and coordinates for arbitrary existing documents without extra work.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 16 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • borb-pdf/borb3,587 ★ · +16
Star history
Repository2026-09-242026-11-24
borb-pdf/borb3.6k3.6k

16 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What borb is for and who reaches for it

borb is a Python library for reading, creating and manipulating PDF files. The README describes it as a pure Python solution, which matters in practice: there is no C extension to compile and no external PDF binary to shell out to, so a build that installs borb behaves the same on a laptop and in a container. The stated target is common PDF use cases, and the README is explicit that this is a solo project rather than a corporate SDK.

The audience is Python developers who need to produce documents or edit existing ones from code. The README lists metadata management, text and image extraction, annotations such as notes and links, content manipulation with text, images, tables and lists, and page layout management through PageLayout. That is a generator's feature list more than a forensic parser's. If your job is to render invoices, reports or generated paperwork, the shape of the API is aimed at you. If your job is to pull structured data out of thousands of third-party PDFs with wildly different producers, the README does not promise that level of extraction detail.

The JSON-like document model behind borb

The design choice that separates borb from wrappers around other engines is stated plainly in the README: it models PDF files in a JSON-like structure, using nested lists, dictionaries and primitives such as numbers, strings and booleans. A PDF file is a tree of objects, and borb exposes that tree rather than hiding it behind a fixed set of high-level classes. Reading a document and reading a dictionary are therefore the same kind of operation.

On top of that model sits a layout layer. The hello world example builds a Document, appends a Page, wraps the page in a SingleColumnLayout, and appends a Paragraph to the layout. The layout object is what decides where the paragraph lands; you hand it content and it flows it down the page. This is the same split you see in typesetting systems: content objects on one side, a flow algorithm on the other. It also means the layout is a constraint you accept. SingleColumnLayout gives you one column, and anything more elaborate has to come from elsewhere or from your own code.

Writing is the final step. The example calls PDF.write with the document and a destination path. That is the whole pipeline: build the object tree, append content to a layout, serialise.

Installing borb and producing a first PDF

The README gives a single install command. It also suggests a clean reinstall if you want to be sure you are on the newest release, which is a reasonable habit given that releases land on PyPI rather than through a separate installer.

bash
pip install borb

If you suspect a stale wheel is being served from the local cache, the README offers this pair of commands instead:

bash
pip uninstall borb
pip install --no-cache borb

With the package in place, the hello world example from the README is the shortest path to a real file. It creates a document, adds a page, wraps it in a single-column layout, appends one paragraph, and writes the result to assets/output.pdf. The directory has to exist before the write call, since the example passes the path directly.

python
from pathlib import Path
from borb.pdf import Document, Page, PageLayout, SingleColumnLayout, Paragraph, PDF

d: Document = Document()
p: Page = Page()
d.append_page(p)

l: PageLayout = SingleColumnLayout(p)
l.append_layout_element(Paragraph('Hello World!'))

PDF.write(what=d, where_to="assets/output.pdf")

After running it, assets/output.pdf contains one page with the text Hello World! positioned by the layout object, not by coordinates you supplied.

Where the single-column layout stops being enough

SingleColumnLayout is the example the README leads with, and it is honest about the limitation by naming the class that way. One column, flowing downward. Multi-column layouts, absolute positioning, or a design that needs content placed at exact coordinates are not what this helper is for. The README mentions PageLayout as the general concept and SingleColumnLayout as the concrete example, so the extension point exists, but the documentation in the README does not walk through writing your own layout algorithm.

The second limitation is the licence, and it is a bigger practical constraint than any API gap. borb is dual-licensed under AGPL and a commercial licence. The README states that commercial use cases require a paid licence, and lists three situations: offering paid PDF services such as PDF generation in cloud applications, using borb in closed-source projects, and distributing borb in any closed-source product. That covers a large share of ordinary commercial work. A web service that renders PDFs for paying customers is named directly. If your product is closed source, the free path is not open to you.

The third thing to check is the extras. The setup.py file declares optional dependency groups rather than one flat requirement list: image pulls in matplotlib, Pillow, python-barcode, py_avataaars, requests and segno; text pulls in fonttools and requests; genai pulls in openai. A full group is assembled from all of these except dev and docs. The base install does not bring them in, so image or font work needs the extra group installed explicitly.

How borb compares with a parser-first library

The obvious alternative in the Python ecosystem is a parser-first library such as pdfplumber, which is oriented around extracting text and tables from existing PDFs and reporting where that content sits on the page. The difference in approach is the direction of travel. pdfplumber starts from a file someone else made and tries to describe it. borb starts from an object tree you construct and tries to write it, with reading as a second capability on the same model.

That distinction decides most choices. If you have a folder of supplier invoices and need the totals out, a parser-first tool is the natural fit and borb's layout classes do nothing for you. If you have data in a database and need a paginated PDF out, borb's model is the one that maps onto the problem, because you are building the document rather than interpreting it. The README's feature list leans toward the second case: metadata editing, annotations, adding text, images, tables and lists, and page layout.

There is also a licensing contrast worth noting. pdfplumber is distributed under the MIT licence, which permits closed-source commercial use. borb's AGPL branch does not, and the README directs commercial users to a paid licence. For a closed-source product, that single fact can outweigh any API preference.

Reading, writing and the parts the README leaves open

The README says borb can read, write and manipulate PDFs, and lists text and image extraction among the features, pointing to a separate examples repository for practical applications. It does not document the extraction API in the README itself, and it does not describe how faithfully complex existing documents survive a read-then-write round trip. Fonts, embedded subsets, form fields and unusual page trees are the places where PDF libraries usually diverge, and none of them are addressed in the README text.

That is a documentation gap rather than a defect, and it should shape how you evaluate the library. The README does state some measurable claims about the codebase: public method documentation at 100 percent, type checking at 100 percent, and a test suite of over 1400 tests, with supported Python versions listed as 3.10, 3.11 and 3.12. Those are statements about internal discipline, not about extraction accuracy on your files. The setup.py classifiers also still list Python 3.6, 3.7 and 3.8 alongside the newer versions, so the classifier list and the README badge do not agree; treat the README badge as the current statement.

For anything involving existing PDFs, the honest position is that you have to try your own corpus. The README gives no round-trip fidelity claims to rely on.

Maintenance cadence, licence and what a fork costs

The repository is not archived, and the last push was on 2026-08-26. Recent releases are v3.0.7 on 2026-03-16, v3.0.8 on 2026-06-14 and v3.0.9 on 2026-08-03. That is a steady release rhythm over the past six months, and the project describes itself as created and maintained as a solo project. A single maintainer is a real risk factor: the cadence depends on one person, and there is no second committer to absorb a gap.

On licence, the README is direct. borb is dual-licensed under AGPL and a commercial licence. The AGPL branch is an open-source licence, but the README states that commercial use cases require a paid licence and names three of them: paid PDF services such as PDF generation in cloud applications, use in closed-source projects, and distribution in a closed-source product. The setup.py classifier identifies the open-source branch as GNU Affero General Public License v3 or later. I am not a lawyer and this is not legal advice: the practical point is that AGPL obligations attach to network use, so a hosted service built on borb is exactly the scenario the README flags. Anyone planning to ship borb inside a product should read the licence text in LICENSE.md and the terms on borbpdf.com before writing code, not after.

Upgrade cost is modest on the surface. Version numbers have moved within the 3.0 line, and installation is a pip command with a suggested cache-free reinstall. The hidden cost is the optional dependency groups in setup.py: an upgrade that changes what the image or text group needs will not surface until you install the extra again.

Editorial conclusion

borb suits Python developers who want to generate or edit PDFs programmatically and can live with AGPL terms or buy the commercial licence. It is the wrong choice for closed-source products that will not pay, and for anyone who needs a PDF parser that reports positions and coordinates for arbitrary existing documents without extra work. Before adopting, verify the licence terms for your distribution model on borbpdf.com, and check that the extras you need (image, text, genai) are installed alongside the base package, since they are declared as optional groups in setup.py rather than pulled in by default.

Frequently asked questions

How do I install borb?

Install it from PyPI with pip install borb. The README also suggests pip uninstall borb followed by pip install --no-cache borb if you want to be certain you have the latest version.

Is borb free for commercial use?

borb is dual-licensed under AGPL and a commercial licence, and the README states that commercial use cases require a paid licence. It names paid PDF services, closed-source projects and distribution in a closed-source product as examples.

Which Python versions does borb support?

The README badge lists Python 3.10, 3.11 and 3.12. The classifiers in setup.py also mention older versions, so the README badge is the more current statement.

How do I create a PDF with borb?

The README example creates a Document, appends a Page, wraps the page in a SingleColumnLayout, appends a Paragraph to the layout, and calls PDF.write with the document and an output path.

Official sources

  1. borb-pdf/borb on GitHub
  2. Issues
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/borb-pdf-borb.svg)](https://hysenlabs.com/projects/borb-pdf-borb)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/borb-pdf-borb.svg)](https://hysenlabs.com/projects/borb-pdf-borb)

Was this useful?