Skip to main content

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

Project description

borb logo borb

Code style: black Corpus Coverage : 99.0% Text Extraction : 88.6% Public Method Documentation : 100%

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

0. About borb

borb is a pure python library to read, write and manipulate PDF documents. It represents a PDF document as a JSON-like datastructure of nested lists, dictionaries and primitives (numbers, string, booleans, etc)

This is currently a one-man project, so the focus will always be to support those use-cases that are more common in favor of those that are rare.

1. About the Examples

Most examples double as tests, you can find them in the 'tests' directory.
They include;

  • Reading a PDF and extracting meta-information
  • Changing meta-information
  • Extracting text from a PDF
  • Extracting images from a PDF
  • Changing images in a PDF
  • Adding annotations (notes, links, etc) to a PDF
  • Adding text to a PDF
  • Adding tables to a PDF
  • Adding lists to a PDF
  • Using a PageLayout manager

and much more

1.1 Hello World

To give you an immediate idea of the way borb works, this is the classic Hello World example, in borb:

from pathlib import Path

from borb.pdf.canvas.layout.page_layout.multi_column_layout import SingleColumnLayout
from borb.pdf.canvas.layout.text.paragraph import Paragraph
from borb.pdf.document import Document
from borb.pdf.page.page import Page
from borb.pdf.pdf import PDF

# create an empty Document
pdf = Document()

# add an empty Page
page = Page()
pdf.append_page(page)

# use a PageLayout (SingleColumnLayout in this case)
layout = SingleColumnLayout(page)

# add a Paragraph object
layout.add(Paragraph("Hello World!"))

# store the PDF
with open(Path("output.pdf"), "wb") as pdf_file_handle:
    PDF.dumps(pdf_file_handle, pdf)

2. License

borb is dual licensed as AGPL/Commercial software.

AGPL is a free / open source software license. This doesn't mean the software is gratis!

Buying a license is mandatory as soon as you develop commercial activities distributing the borb software inside your product or deploying it on a network without disclosing the source code of your own applications under the AGPL license. These activities include:

  • Offering paid services to customers as an ASP
  • Serving PDFs on the fly in the cloud or in a web application
  • Shipping borb with a closed source product

Contact sales for more info.

3. Acknowledgements

I would like to thank the following people, for their contributions / advice with regards to developing borb:

  • Aleksander Banasik
  • Benoît Lagae
  • Michael Klink

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

borb-2.0.8.tar.gz (5.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

borb-2.0.8-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

File details

Details for the file borb-2.0.8.tar.gz.

File metadata

  • Download URL: borb-2.0.8.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for borb-2.0.8.tar.gz
Algorithm Hash digest
SHA256 e1694db8ec885bf99963e427a60170721034598db86858ed6f95f1751f0b3240
MD5 68b32c530315b7fff289d756893320f0
BLAKE2b-256 4aed84f8a8396cedd264eb2f9fe19c720f0baf122de35b9fb4acdf5395420d52

See more details on using hashes here.

File details

Details for the file borb-2.0.8-py3-none-any.whl.

File metadata

  • Download URL: borb-2.0.8-py3-none-any.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for borb-2.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ff2f1b913bd15439dee2f622965727d79d247bf74ceef3adac6c1aa25a837b80
MD5 711fdbc894f3475172569fdddc0c1b7d
BLAKE2b-256 90c99bd73172ca8279cccd4fff5b5012a176ddcecc5e539ceb9129da5e92611c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page