MCPcopy
hub / github.com/borb-pdf/borb

github.com/borb-pdf/borb @v3.0.8 sqlite

repository ↗ · DeepWiki ↗ · release v3.0.8 ↗
3,655 symbols 33,701 edges 969 files 1,352 documented · 37%
README

borb logo borb

Code style: black Public Method Documentation: 100% Tests: 1400+ Python Versions: 3.10, 3.11, 3.12 Type Checking: 100% Downloads Monthly Downloads

borb is a powerful and flexible Python library for creating and manipulating PDF files.

📖 Overview

borb provides a pure Python solution for PDF document management, allowing users to read, write, and manipulate PDFs. It models PDF files in a JSON-like structure, using nested lists, dictionaries, and primitives (numbers, strings, booleans, etc.). Created and maintained as a solo project, borb prioritizes common PDF use cases for practical and straightforward usage.

✨ Features

Explore borb’s capabilities in the examples repository for practical, real-world applications, including:

  • PDF Metadata Management (reading, editing)
  • Text and Image Extraction
  • Adding Annotations (notes, links)
  • Content Manipulation (adding text, images, tables, lists)
  • Page Layout Management with PageLayout

…and much more!

🚀 Installation

Install borb directly via pip:

pip install borb

To ensure you have the latest version, consider the following commands:

pip uninstall borb
pip install --no-cache borb

👋 Getting Started: Hello World

Create your first PDF in just a few lines of code with borb:

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

# Create an empty Document
d: Document = Document()

# Create an empty Page
p: Page = Page()
d.append_page(p)

# Create a PageLayout
l: PageLayout = SingleColumnLayout(p)

# Add a Paragraph
l.append_layout_element(Paragraph('Hello World!'))

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

🛠 License

borb is dual-licensed under AGPL and a commercial license.

The AGPL (Affero General Public License) is an open-source license, but commercial use cases require a paid license, especially if you intend to:

  • Offer paid PDF services (e.g., PDF generation in cloud applications)
  • Use borb in closed-source projects
  • Distribute borb in any closed-source product

For more information, contact our sales team.

🙏 Acknowledgements

Special thanks to:

  • Aleksander Banasik
  • Benoît Lagae
  • Michael Klink

Your contributions and guidance have been invaluable to borb's development.

Core symbols most depended-on inside this repo

get_size
called by 6186
borb/pdf/page.py
write
called by 1334
borb/pdf/visitor/pdf.py
append_page
called by 1316
borb/pdf/document.py
paint
called by 1192
borb/pdf/layout_element/shape/map.py
append_layout_element
called by 1036
borb/pdf/layout_element/list/list.py
get
called by 304
borb/pdf/font/simple_font/standard_14_fonts.py
get_bytes
called by 218
borb/pdf/visitor/read/read_visitor.py
generate_lorem_ipsum
called by 170
borb/pdf/lipsum/lipsum.py

Shape

Method 2,743
Class 911
Function 1

Languages

Python100%

Modules by API surface

borb/pdf/layout_element/shape/line_art.py63 symbols
borb/pdf/document_layout/slideshow.py42 symbols
borb/pdf/document_layout/a4_portrait.py41 symbols
borb/pdf/layout_element/layout_element.py33 symbols
borb/pdf/toolkit/sink/regex.py23 symbols
borb/pdf/visitor/read/dict_visitor.py21 symbols
borb/pdf/primitives.py21 symbols
borb/pdf/layout_element/smart_art/smart_art.py19 symbols
borb/pdf/document.py19 symbols
borb/pdf/visitor/validate/conformance_checks.py18 symbols
borb/pdf/document_layout/a4_portrait_resume.py18 symbols
borb/pdf/document_layout/a4_portrait_invoice.py18 symbols

For agents

$ claude mcp add borb \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact