GithubHelp home page GithubHelp logo

manodeep / borb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jorisschellekens/borb

1.0 2.0 0.0 159.18 MB

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

Home Page: https://borbpdf.com/

License: Other

Python 99.10% HTML 0.82% CSS 0.08%

borb's Introduction

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

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.

Check out the examples repository here!

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

There are also some great examples that use Google Colab, so that you can check out the functionality of borb without having to install anything on your system.

Check out the Google Colab examples repository here!

1.0 Installing borb

borb can be installed using pip

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 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 information.

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

borb's People

Contributors

jorisschellekens avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.