Working with PDF can be complex and challenging at the best of times. This is why borb was created with user-friendliness in mind. Users are not required to have extensive PDF knowledge.
Many competing libraries require the user to have detailed knowledge of the inner workings of the PDF format. Even something as trivial as adding text to a page would require you to know the coordinate system in PDF.
borb offers automatic page layout that takes care of margins, padding, leading, and more.
borb alternatives and similar packages
Based on the "PDF" category.
Alternatively, view borb alternatives based on common mentions on social networks and blogs.
8.3 9.8 L2 borb VS PyPDF2A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files
6.5 1.6 L3 borb VS pdftabextractA set of tools for extracting tables from PDF files helping to do data mining on (OCR-processed) scanned documents.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of borb or a related project?
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
The examples can be found in a separate repository.
This ensures the
borb repository stays relatively small, whilst still providing a thorough knowledgebase of code-samples, screenshots and explanatory text.
- 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
borb can be installed using
pip install borb
If you have installed
borb before, and you want to ensure
pip downloads the latest version (rather than using its internal cache) you can use the following commands:
pip uninstall borb pip install --no-cache borb
1.1 Hello World
To give you an immediate idea of the way
this is the classic
Hello World example, in
from pathlib import Path from borb.pdf import Document from borb.pdf import Page from borb.pdf import SingleColumnLayout from borb.pdf import Paragraph from borb.pdf import PDF # create an empty Document pdf = Document() # add an empty Page page = Page() pdf.add_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)
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
borbwith a closed source product
Contact sales for more information.
I would like to thank the following people, for their contributions / advice with regards to developing
- Aleksander Banasik
- Benoît Lagae
- Michael Klink
*Note that all licence references and agreements mentioned in the borb README section above are relevant to that project's source code only.