Skip to content

Commit

Permalink
Merge pull request #15 from maxpmaxp/v0.1.3rc1
Browse files Browse the repository at this point in the history
V0.1.3rc1
  • Loading branch information
maxpmaxp committed Dec 20, 2019
2 parents ba6cbc1 + d49cc05 commit ce2d37f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -10,6 +10,7 @@ recursive-include doc *.conf
recursive-include doc *.png
recursive-include doc *.pdf
prune venv
prune .venv
prune doc/_build
prune dist
exclude example-crash-markdown.txt extract-logo.png fax-from-p8.png mask.png sample-cmap.txt sample-font.type1
9 changes: 4 additions & 5 deletions doc/examples/extract_fonts.rst
Expand Up @@ -32,13 +32,12 @@ Now let's see what fonts the very first page uses:
.. doctest::

>>> page = next(doc.pages())
>>> page.Resources.Font
{'T1_0': <IndirectReference:n=22,g=0>, ... <IndirectReference:n=41,g=0>}

>>> sorted(page.Resources.Font.keys())
['T1_0', 'T1_1', 'T1_2', 'TT0', 'TT1']

We see 5 fonts named `T1_0`, `T1_1`, `T1_2`, `TT0` and `TT1`.
As *pdfreader* is a lazy reader the font data has not been read yet. We just see the names and
the references to the objects.
As *pdfreader* is a lazy reader the font data has not been read yet.
We just have the names and the references to the objects.

Let's have a look at font `T1_0`.

Expand Down
4 changes: 2 additions & 2 deletions doc/examples/extract_form_text.rst
Expand Up @@ -53,8 +53,8 @@ listed under page resources. The viewer puts them on canvas:

.. doctest::

>>> list(viewer.canvas.forms.keys())
['Fm1', 'Fm2', ... 'Fm29', 'Fm30', 'Fm31']
>>> sorted(list(viewer.canvas.forms.keys()))
['Fm1', 'Fm10', 'Fm11', 'Fm12', 'Fm13', 'Fm14',...]

As Form is a kind of "sub-document" every entry in *viewer.canvas.forms* dictionary maps to
:class:`~pdfreader.viewer.SimpleCanvas` instance:
Expand Down
6 changes: 6 additions & 0 deletions pdfreader/CHANGELOG.txt
@@ -0,0 +1,6 @@
pdfreader 0.1.3, 2019-12-20
---------------------------
- CMap-based text decoding issue fixed
- Multiple filters support for inline images added
- nbspace added to MacRomanEncoding and WinAnsiEncoding
- GraphicsState issue issue related to loosing some state attributes fixed
2 changes: 1 addition & 1 deletion pdfreader/__init__.py
Expand Up @@ -5,4 +5,4 @@
register_pdf_encodings()

#: package version
__version__ = version = '0.1.3rc1'
__version__ = version = '0.1.3'
7 changes: 5 additions & 2 deletions pdfreader/parsers/base.py
Expand Up @@ -361,8 +361,11 @@ def dictionary(self):
... /Item4 (OK)
... >>
... >>'''
>>> BasicTypesParser(s, 0).dictionary()
{'Type': 'Example', 'Subtype': 'DictExample', 'Version': Decimal('0.01'), 'IntegerItem': 12, 'StringItem': b'a string', 'ArrayItem': [1, 2], 'ObjRef': <IndirectReference:n=12,g=0>, 'SubDictionary': {'Item1': True, 'Item2': False, 'Item3': None, 'Item4': b'OK'}}
>>> expected = {'Type': 'Example', 'Subtype': 'DictExample', 'Version': Decimal('0.01'), 'IntegerItem': 12,
... 'StringItem': b'a string', 'ArrayItem': [1, 2], 'ObjRef': IndirectReference(12, 0),
... 'SubDictionary': {'Item1': True, 'Item2': False, 'Item3': None, 'Item4': b'OK'}}
>>> BasicTypesParser(s, 0).dictionary() == expected
True
"""
pfx = self.read(2)
Expand Down
6 changes: 4 additions & 2 deletions pdfreader/parsers/document.py
Expand Up @@ -194,8 +194,10 @@ def trailer(self):
... /ID [<0102AA> <0102BB>]
... >>'''
>>> p = PDFParser(s, 0)
>>> p.trailer()
<Trailer: {'Size': 22, 'Root': <IndirectReference:n=2,g=0>, 'Info': <IndirectReference:n=1,g=0>, 'ID': ['0102AA', '0102BB']}>
>>> expected_params = {'Size': 22, 'Root': IndirectReference(2,0),
... 'Info': IndirectReference(1,0), 'ID': ['0102AA', '0102BB']}
>>> p.trailer() == Trailer(expected_params)
True
"""
token = self.read(7)
if token != b'trailer':
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -9,7 +9,7 @@
if sys.version_info[:2] < (3, 6):
warnings.warn("Python version >= 3.6 required.")

version = '0.1.3rc1'
version = '0.1.3'


import os.path
Expand Down

0 comments on commit ce2d37f

Please sign in to comment.