Skip to content

Commit

Permalink
release v2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisschellekens committed Jul 24, 2021
1 parent 5492771 commit fd74c11
Show file tree
Hide file tree
Showing 1,773 changed files with 94,651 additions and 6,351 deletions.
173 changes: 84 additions & 89 deletions EXAMPLES.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
include ptext/pdf/canvas/font/afm/*.afm
include ptext/io/write/ascii_art/ascii_logo.txt
include borb/io/write/ascii_art/ascii_logo.txt
include borb/pdf/canvas/font/composite_font/cmaps/*
include borb/pdf/canvas/font/simple_font/afm/*.afm
include borb/pdf/canvas/layout/emoji/resources/*.png
include borb/pdf/canvas/layout/hyphenation/resources/*.json
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@

# pText
# ![borb logo](readme_img/logo/borb_64.png) borb


[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Corpus Coverage : 97.0%](https://img.shields.io/badge/corpus%20coverage-97.0%25-green)]()
[![Text Extraction : 87.9%](https://img.shields.io/badge/text%20extraction-87.9%25-orange)]()
[![Public Method Documentation : 100%](https://img.shields.io/badge/public%20method%20documentation-100%25-green)]()


pText is a library for creating and manipulating PDF files in python.
`borb` is a library for creating and manipulating PDF files in python.
This project (previously `pText`) has been renamed to avoid ruffling any feathers.

## 0. About pText
## 0. About borb

pText 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)
`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.

Expand All @@ -33,15 +35,15 @@ They include;

### 1.1 Hello World

To give you an immediate idea of the way `pText` works, this is the classic `Hello World` example, in `pText`:
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 ptext.pdf.canvas.layout.page_layout import SingleColumnLayout
from ptext.pdf.canvas.layout.text.paragraph import Paragraph,
from ptext.pdf.document import Document
from ptext.pdf.page.page import Page
from ptext.pdf.pdf import PDF
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()
Expand All @@ -62,22 +64,23 @@ To give you an immediate idea of the way `pText` works, this is the classic `Hel

## 2. License

pText is dual licensed as AGPL/Commercial software.
`borb` is dual licensed as AGPL/Commercial software.

AGPL is a free / open source software license.
This doesn't mean the software is [gratis](https://en.wikipedia.org/wiki/Gratis_versus_libre)!

Buying a license is mandatory as soon as you develop commercial activities distributing the pText software inside your product or deploying it on a network without disclosing the source code of your own applications under the AGPL license.
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 pText with a closed source product
- 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 `pText`:
I would like to thank the following people, for their contributions / advice with regards to developing `borb`:
- Aleksander Banasik
- Benoît Lagae
- Michael Klink
14 changes: 7 additions & 7 deletions ptext/__init__.py → borb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
This file is part of the ptext (R) project.
Copyright (c) 2020-2040 ptext Group NV
This file is part of the borb (R) project.
Copyright (c) 2020-2040 borb Group NV
Authors: Joris Schellekens, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
PTEXT GROUP. PTEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
BORB GROUP. BORB GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
Expand All @@ -27,17 +27,17 @@
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using ptext.
or manipulated using borb.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the ptext software without
develop commercial activities involving the borb software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping ptext with a closed
serving PDFs on the fly in a web application, shipping borb with a closed
source product.
For more information, please contact ptext Software Corp. at this
For more information, please contact borb Software Corp. at this
address: [email protected]
"""
14 changes: 7 additions & 7 deletions ptext/io/__init__.py → borb/datastructure/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
This file is part of the ptext (R) project.
Copyright (c) 2020-2040 ptext Group NV
This file is part of the borb (R) project.
Copyright (c) 2020-2040 borb Group NV
Authors: Joris Schellekens, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
PTEXT GROUP. PTEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
BORB GROUP. BORB GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
Expand All @@ -27,17 +27,17 @@
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using ptext.
or manipulated using borb.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the ptext software without
develop commercial activities involving the borb software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping ptext with a closed
serving PDFs on the fly in a web application, shipping borb with a closed
source product.
For more information, please contact ptext Software Corp. at this
For more information, please contact borb Software Corp. at this
address: [email protected]
"""
File renamed without changes.
59 changes: 59 additions & 0 deletions borb/datastructure/str_trie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
This class represents a trie[str, typing.Any]
"""
import typing


class Trie:
"""
This class represents a trie[str, typing.Any]
"""

class TrieNode:
"""
This class represents a node in a trie
"""

def __init__(self, value: typing.Optional[typing.Any] = None):
self._children: typing.Dict[str, "TrieNode"] = {}
self._value: typing.Optional[typing.Any] = value

def __len__(self) -> int:
return (0 if self._value is None else 1) + sum(
[len(v) for k, v in self._children.items()]
)

def __init__(self):
self._root: typing.Optional[Trie.TrieNode] = None

def __len__(self) -> int:
return 0 if self._root is None else len(self._root)

def __getitem__(self, item) -> typing.Optional[typing.Any]:
n: typing.Optional[Trie.TrieNode] = self._root
if n is None:
return None
for c in item:
if c in n._children:
n = n._children[c]
else:
return None
assert n is not None
return n._value

def __setitem__(self, key, value):
n: typing.Optional[Trie.TrieNode] = self._root
if n is None:
self._root = Trie.TrieNode()
n = self._root
assert n is not None
for c in key:
if c not in n._children:
n._children[c] = Trie.TrieNode()
n = n._children[c]
assert n is not None
n._value = value
return self
14 changes: 7 additions & 7 deletions ptext/io/filter/__init__.py → borb/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
This file is part of the ptext (R) project.
Copyright (c) 2020-2040 ptext Group NV
This file is part of the borb (R) project.
Copyright (c) 2020-2040 borb Group NV
Authors: Joris Schellekens, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
PTEXT GROUP. PTEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
BORB GROUP. BORB GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
Expand All @@ -27,17 +27,17 @@
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using ptext.
or manipulated using borb.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the ptext software without
develop commercial activities involving the borb software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping ptext with a closed
serving PDFs on the fly in a web application, shipping borb with a closed
source product.
For more information, please contact ptext Software Corp. at this
For more information, please contact borb Software Corp. at this
address: [email protected]
"""
14 changes: 7 additions & 7 deletions ptext/io/read/__init__.py → borb/io/filter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
This file is part of the ptext (R) project.
Copyright (c) 2020-2040 ptext Group NV
This file is part of the borb (R) project.
Copyright (c) 2020-2040 borb Group NV
Authors: Joris Schellekens, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
PTEXT GROUP. PTEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
BORB GROUP. BORB GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
Expand All @@ -27,17 +27,17 @@
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using ptext.
or manipulated using borb.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the ptext software without
develop commercial activities involving the borb software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping ptext with a closed
serving PDFs on the fly in a web application, shipping borb with a closed
source product.
For more information, please contact ptext Software Corp. at this
For more information, please contact borb Software Corp. at this
address: [email protected]
"""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"""
import typing

from ptext.io.filter.ascii85_decode import ASCII85Decode
from ptext.io.filter.flate_decode import FlateDecode
from ptext.io.filter.lzw_decode import LZWDecode
from ptext.io.filter.run_length_decode import RunLengthDecode
from ptext.io.read.types import Decimal, Dictionary, List, Name, Stream
from borb.io.filter.ascii85_decode import ASCII85Decode
from borb.io.filter.flate_decode import FlateDecode
from borb.io.filter.lzw_decode import LZWDecode
from borb.io.filter.run_length_decode import RunLengthDecode
from borb.io.read.types import Decimal, Dictionary, List, Name, Stream


def decode_stream(s: Stream) -> Stream:
Expand Down
43 changes: 43 additions & 0 deletions borb/io/read/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
This file is part of the borb (R) project.
Copyright (c) 2020-2040 borb Group NV
Authors: Joris Schellekens, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
BORB GROUP. BORB GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA.
The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using borb.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the borb software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping borb with a closed
source product.
For more information, please contact borb Software Corp. at this
address: [email protected]
"""
Loading

0 comments on commit fd74c11

Please sign in to comment.