pdfreader 0.1.14__tar.gz → 0.1.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pdfreader-0.1.14 → pdfreader-0.1.16}/CHANGELOG.txt +30 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/MANIFEST.in +2 -1
- pdfreader-0.1.16/PKG-INFO +148 -0
- pdfreader-0.1.16/README.rst +86 -0
- pdfreader-0.1.16/RELEASING.md +40 -0
- pdfreader-0.1.16/benchmarks/requirements.txt +5 -0
- pdfreader-0.1.16/doc/api/document.rst +23 -0
- pdfreader-0.1.16/doc/api/index.rst +46 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/api/types.rst +9 -2
- pdfreader-0.1.16/doc/api/viewer.rst +108 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/conf.py +16 -2
- pdfreader-0.1.16/doc/examples/document_vs_viewer.rst +61 -0
- pdfreader-0.1.16/doc/examples/extract_cmap.rst +86 -0
- pdfreader-0.1.16/doc/examples/extract_fonts.rst +75 -0
- pdfreader-0.1.16/doc/examples/extract_form_text.rst +69 -0
- pdfreader-0.1.16/doc/examples/extract_image.rst +142 -0
- pdfreader-0.1.16/doc/examples/extract_page_text.rst +119 -0
- pdfreader-0.1.16/doc/examples/index.rst +48 -0
- pdfreader-0.1.16/doc/examples/navigate_objects.rst +107 -0
- pdfreader-0.1.16/doc/index.rst +86 -0
- pdfreader-0.1.16/doc/installation.rst +59 -0
- pdfreader-0.1.16/doc/pdf-compatibility.rst +43 -0
- pdfreader-0.1.16/doc/requirements.txt +3 -0
- pdfreader-0.1.16/doc/tutorial.rst +470 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/__init__.py +1 -1
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/decoder.py +15 -4
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/differences.py +1 -1
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/document.py +9 -2
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/ccittfax.py +222 -4
- pdfreader-0.1.16/pdfreader/filters/dct.py +8 -0
- pdfreader-0.1.16/pdfreader/filters/jbig2.py +9 -0
- pdfreader-0.1.16/pdfreader/filters/jpx.py +9 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/lzw.py +16 -5
- pdfreader-0.1.16/pdfreader/filters/test_ccittf_fax.py +397 -0
- pdfreader-0.1.16/pdfreader/filters/test_lzw.py +93 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/base.py +10 -4
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap.py +9 -8
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/content.py +2 -2
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/document.py +20 -8
- pdfreader-0.1.16/pdfreader/parsers/test_base.py +30 -0
- pdfreader-0.1.16/pdfreader/test_document.py +44 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/tests.py +2 -1
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/native.py +2 -2
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/utils.py +11 -3
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/canvas.py +25 -1
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/graphicsstate.py +1 -1
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/pdfviewer.py +11 -7
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/resources.py +2 -2
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/simple.py +19 -6
- pdfreader-0.1.16/pdfreader/viewer/test_annotations.py +62 -0
- pdfreader-0.1.16/pdfreader/viewer/test_grouped_text.py +80 -0
- pdfreader-0.1.16/pdfreader.egg-info/PKG-INFO +148 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader.egg-info/SOURCES.txt +9 -8
- pdfreader-0.1.16/pdfreader.egg-info/requires.txt +36 -0
- pdfreader-0.1.16/pyproject.toml +12 -0
- pdfreader-0.1.16/requirements.txt +7 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/setup.py +32 -15
- pdfreader-0.1.14/PKG-INFO +0 -117
- pdfreader-0.1.14/README.rst +0 -93
- pdfreader-0.1.14/doc/api/document.rst +0 -15
- pdfreader-0.1.14/doc/api/index.rst +0 -48
- pdfreader-0.1.14/doc/api/viewer.rst +0 -81
- pdfreader-0.1.14/doc/examples/document_vs_viewer.rst +0 -47
- pdfreader-0.1.14/doc/examples/downloads/example-crash-markdown.txt +0 -5402
- pdfreader-0.1.14/doc/examples/downloads/sample-cmap.txt +0 -13
- pdfreader-0.1.14/doc/examples/downloads/tutorial-sample-content-stream-p1.txt +0 -684
- pdfreader-0.1.14/doc/examples/extract_cmap.rst +0 -90
- pdfreader-0.1.14/doc/examples/extract_fonts.rst +0 -78
- pdfreader-0.1.14/doc/examples/extract_form_text.rst +0 -70
- pdfreader-0.1.14/doc/examples/extract_image.rst +0 -151
- pdfreader-0.1.14/doc/examples/extract_page_text.rst +0 -124
- pdfreader-0.1.14/doc/examples/index.rst +0 -51
- pdfreader-0.1.14/doc/examples/navigate_objects.rst +0 -115
- pdfreader-0.1.14/doc/extract-logo.png +0 -0
- pdfreader-0.1.14/doc/fax-from-p8.png +0 -0
- pdfreader-0.1.14/doc/index.rst +0 -101
- pdfreader-0.1.14/doc/installation.rst +0 -57
- pdfreader-0.1.14/doc/mask.png +0 -0
- pdfreader-0.1.14/doc/requirements.txt +0 -2
- pdfreader-0.1.14/doc/tutorial.rst +0 -431
- pdfreader-0.1.14/pdfreader/filters/dct.py +0 -5
- pdfreader-0.1.14/pdfreader/filters/jbig2.py +0 -5
- pdfreader-0.1.14/pdfreader/filters/jpx.py +0 -5
- pdfreader-0.1.14/pdfreader/filters/test_ccittf_fax.py +0 -144
- pdfreader-0.1.14/pdfreader.egg-info/PKG-INFO +0 -117
- pdfreader-0.1.14/pdfreader.egg-info/entry_points.txt +0 -3
- pdfreader-0.1.14/pdfreader.egg-info/requires.txt +0 -4
- pdfreader-0.1.14/requirements.txt +0 -4
- pdfreader-0.1.14/tutorial-sample-content-stream-p1.txt +0 -684
- {pdfreader-0.1.14 → pdfreader-0.1.16}/CONTRIBUTING.rst +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/LICENSE +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/SECURITY.md +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/THIRD-PARTY-NOTICES +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/__init__.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/img/example-image-mask.png +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/img/example-logo.png +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/img/example-parse-form.png +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/img/example-text-crash-report.png +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/annot-sample.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/encrypted-with-qwerty.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/example-font.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/example-form.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/example-image-xobject.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/example-text-crash-report.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/doc/examples/pdfs/tutorial-example.pdf +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/buffer.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/__init__.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/agl.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-CNS1-0 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-CNS1-3 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-CNS1-4 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-GB1-0 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-GB1-2 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-GB1-4 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Japan1-1 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Japan1-2 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Japan1-4 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Japan1-5 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Korea1-0 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Korea1-1 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Adobe-Korea1-2 +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/Identity-H +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/cmaps/README.md +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/codec.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/macroman.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/pdfdoc.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/standard.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/tests.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/winansi.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/codecs/zapfdingbatsgl.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/constants.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/exceptions.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/__init__.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/ascii85.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/asciihex.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/crypt.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/flate.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/predictors.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/runlength.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/filters/tests.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/__init__.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap-samples/cmap-empty-name.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap-samples/cmap-sample-2.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap-samples/cmap-sample-3.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap-samples/cmap-sample-bfrange-with-list.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap-samples/cmap-sample-missing-name.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/cmap-samples/cmap-sample.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/inlineimage.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/objstm.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/parsers/tests.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/pillow.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/registry.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/securityhandler.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/__init__.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/cmap.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/constants.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/content.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/filestructure.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/objects.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/tests.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/types/xref.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/__init__.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader/viewer/tests.py +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader.egg-info/dependency_links.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader.egg-info/not-zip-safe +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/pdfreader.egg-info/top_level.txt +0 -0
- {pdfreader-0.1.14 → pdfreader-0.1.16}/setup.cfg +0 -0
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
pdfreader 0.1.16
|
|
2
|
+
---------------------------
|
|
3
|
+
- support and test Python 3.6 through Python 3.14
|
|
4
|
+
- issue #135 - fix trailer parsing for linearized PDFs
|
|
5
|
+
- issue #98 - correctly stop LZW decoding at the end-of-information code
|
|
6
|
+
- issue #107 - make recursive PDF object representations cycle-safe
|
|
7
|
+
- issue #102 - decode CCITT Group 3 one-dimensional images
|
|
8
|
+
- issue #76 - expose page annotations on ``SimpleCanvas`` while preserving the
|
|
9
|
+
``SimplePDFViewer.annotations`` compatibility alias
|
|
10
|
+
- document and test existing PDF 2.0 file-header recognition without claiming
|
|
11
|
+
complete ISO 32000-2 feature support
|
|
12
|
+
- accept PDF comments that end at end-of-file without a final newline
|
|
13
|
+
- add opt-in text fragments grouped by PDF text-showing operator
|
|
14
|
+
- preserve resource loading compatibility on Python 3.6 through Python 3.8
|
|
15
|
+
- modernize package builds, CI validation, and development artifacts
|
|
16
|
+
- make GitHub Releases the guarded public-PyPI publishing path
|
|
17
|
+
- add reproducible parsing, rendering, and peak-memory benchmarks
|
|
18
|
+
- improve documentation, examples, search metadata, and doctest coverage
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
pdfreader 0.1.15
|
|
22
|
+
---------------------------
|
|
23
|
+
- don't raise error on unsupported stream filters, return raw unfiltered data instead
|
|
24
|
+
- issue #101 - DCT stream data encoding support
|
|
25
|
+
- issue #130 - PDF date regular expression fixed
|
|
26
|
+
- issue #62 - work around unbalanced BT/ET
|
|
27
|
+
- reduced warnings logs noise
|
|
28
|
+
- timezone issue in tests fixed
|
|
29
|
+
- bitarray version bump to 2.9.2
|
|
30
|
+
|
|
1
31
|
pdfreader 0.1.14
|
|
2
32
|
---------------------------
|
|
3
33
|
- issue #106 - use Unicode replace character when codes are out of Unicode range
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
include README.rst
|
|
2
2
|
include CONTRIBUTING.rst
|
|
3
3
|
include CHANGELOG.txt
|
|
4
|
+
include RELEASING.md
|
|
4
5
|
include LICENSE
|
|
5
6
|
include THIRD-PARTY-NOTICES
|
|
6
7
|
include SECURITY.md
|
|
@@ -16,4 +17,4 @@ prune venv
|
|
|
16
17
|
prune .venv
|
|
17
18
|
prune doc/_build
|
|
18
19
|
prune dist
|
|
19
|
-
exclude example-crash-markdown.txt extract-logo.png fax-from-p8.png mask.png sample-cmap.txt sample-font.type1
|
|
20
|
+
exclude example-crash-markdown.txt extract-logo.png fax-from-p8.png mask.png sample-cmap.txt sample-font.type1
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pdfreader
|
|
3
|
+
Version: 0.1.16
|
|
4
|
+
Summary: Read and extract text, images, and metadata from PDF files
|
|
5
|
+
Home-page: http://github.com/maxpmaxp/pdfreader
|
|
6
|
+
Author: Maksym Polshcha
|
|
7
|
+
Author-email: maxp@sterch.net
|
|
8
|
+
Maintainer: Maksym Polshcha
|
|
9
|
+
Maintainer-email: maxp@sterch.net
|
|
10
|
+
License: MIT Licence
|
|
11
|
+
Keywords: pdf,pdfreader,pdfparser,adobe,parser,cmap
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
|
+
Classifier: Operating System :: POSIX
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Topic :: Software Development
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.6
|
|
29
|
+
Description-Content-Type: text/x-rst
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: bitarray<3,>=2.9.2; python_version < "3.7"
|
|
32
|
+
Requires-Dist: bitarray>=2.9.2; python_version >= "3.7"
|
|
33
|
+
Requires-Dist: pillow>=7.1.0
|
|
34
|
+
Requires-Dist: pycryptodome>=3.19.1
|
|
35
|
+
Requires-Dist: python-dateutil>=2.8.1
|
|
36
|
+
Requires-Dist: importlib_resources<6,>=5.4; python_version < "3.9"
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: coverage[toml]<6,>=5.5; python_version < "3.7" and extra == "test"
|
|
39
|
+
Requires-Dist: coverage[toml]>=7.0; python_version >= "3.7" and extra == "test"
|
|
40
|
+
Requires-Dist: flake8<4,>=3.9; python_version < "3.8" and extra == "test"
|
|
41
|
+
Requires-Dist: flake8>=7.0; python_version >= "3.8" and extra == "test"
|
|
42
|
+
Requires-Dist: importlib-metadata<5; python_version < "3.8" and extra == "test"
|
|
43
|
+
Provides-Extra: docs
|
|
44
|
+
Requires-Dist: sphinx<5,>=4.5; python_version < "3.8" and extra == "docs"
|
|
45
|
+
Requires-Dist: sphinx>=7.0; python_version >= "3.8" and extra == "docs"
|
|
46
|
+
Requires-Dist: setuptools<81; extra == "docs"
|
|
47
|
+
Dynamic: author
|
|
48
|
+
Dynamic: author-email
|
|
49
|
+
Dynamic: classifier
|
|
50
|
+
Dynamic: description
|
|
51
|
+
Dynamic: description-content-type
|
|
52
|
+
Dynamic: home-page
|
|
53
|
+
Dynamic: keywords
|
|
54
|
+
Dynamic: license
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
Dynamic: maintainer
|
|
57
|
+
Dynamic: maintainer-email
|
|
58
|
+
Dynamic: provides-extra
|
|
59
|
+
Dynamic: requires-dist
|
|
60
|
+
Dynamic: requires-python
|
|
61
|
+
Dynamic: summary
|
|
62
|
+
|
|
63
|
+
=========
|
|
64
|
+
pdfreader
|
|
65
|
+
=========
|
|
66
|
+
:Info: See the `pdfreader documentation <https://pdfreader.readthedocs.io/en/latest/>`_.
|
|
67
|
+
:Author & Maintainer: Maksym Polshcha <maxp@sterch.net>
|
|
68
|
+
|
|
69
|
+
**pdfreader** is a read-only Python PDF parser for extracting text, images,
|
|
70
|
+
forms, fonts, CMaps, metadata, and other document objects. Use it when you need
|
|
71
|
+
programmatic access to PDF content and structure without editing the file or
|
|
72
|
+
rasterizing every page.
|
|
73
|
+
|
|
74
|
+
The library provides two complementary interfaces:
|
|
75
|
+
|
|
76
|
+
* ``PDFDocument`` exposes the document catalog, page tree, indirect objects,
|
|
77
|
+
streams, and metadata.
|
|
78
|
+
* ``SimplePDFViewer`` interprets page content and writes decoded data to a
|
|
79
|
+
``SimpleCanvas``.
|
|
80
|
+
|
|
81
|
+
What pdfreader provides
|
|
82
|
+
=======================
|
|
83
|
+
|
|
84
|
+
* Direct access to the document catalog, page tree, indirect objects, streams,
|
|
85
|
+
and metadata.
|
|
86
|
+
* Page-level extraction of decoded strings, images, forms, annotations, and
|
|
87
|
+
inline images through ``SimpleCanvas``.
|
|
88
|
+
* Support for password-protected documents that use a supported PDF standard
|
|
89
|
+
security handler.
|
|
90
|
+
* Conversion of supported PDF image objects to Pillow images.
|
|
91
|
+
|
|
92
|
+
pdfreader does not create, edit, split, merge, rasterize, or convert PDF files.
|
|
93
|
+
Extracted text follows content-stream order and does not automatically
|
|
94
|
+
reconstruct visual lines, columns, or tables.
|
|
95
|
+
|
|
96
|
+
PDF version compatibility
|
|
97
|
+
=========================
|
|
98
|
+
|
|
99
|
+
pdfreader targets the PDF 1.7 data model and recognizes standard
|
|
100
|
+
``%PDF-2.0`` file headers. Header recognition does not imply complete support
|
|
101
|
+
for every feature introduced by ISO 32000-2. See the
|
|
102
|
+
`PDF compatibility guide <https://pdfreader.readthedocs.io/en/latest/pdf-compatibility.html>`_
|
|
103
|
+
for the tested boundary and reporting guidance.
|
|
104
|
+
|
|
105
|
+
Installation
|
|
106
|
+
============
|
|
107
|
+
|
|
108
|
+
pdfreader is tested on Python 3.6 through Python 3.14. Install it from PyPI with
|
|
109
|
+
pip::
|
|
110
|
+
|
|
111
|
+
python -m pip install pdfreader
|
|
112
|
+
|
|
113
|
+
Quick example
|
|
114
|
+
=============
|
|
115
|
+
|
|
116
|
+
Extract decoded string fragments from the first page::
|
|
117
|
+
|
|
118
|
+
from pdfreader import SimplePDFViewer
|
|
119
|
+
|
|
120
|
+
with open("document.pdf", "rb") as stream:
|
|
121
|
+
viewer = SimplePDFViewer(stream)
|
|
122
|
+
viewer.navigate(1)
|
|
123
|
+
viewer.render()
|
|
124
|
+
text = "".join(viewer.canvas.strings)
|
|
125
|
+
|
|
126
|
+
Documentation
|
|
127
|
+
=============
|
|
128
|
+
|
|
129
|
+
* `Install or upgrade pdfreader <https://pdfreader.readthedocs.io/en/latest/installation.html>`_
|
|
130
|
+
* `Follow the tutorial <https://pdfreader.readthedocs.io/en/latest/tutorial.html>`_
|
|
131
|
+
* `Check PDF version compatibility <https://pdfreader.readthedocs.io/en/latest/pdf-compatibility.html>`_
|
|
132
|
+
* `Choose PDFDocument or SimplePDFViewer <https://pdfreader.readthedocs.io/en/latest/examples/document_vs_viewer.html>`_
|
|
133
|
+
* `Browse task-based examples <https://pdfreader.readthedocs.io/en/latest/examples/index.html>`_
|
|
134
|
+
* `Read the API reference <https://pdfreader.readthedocs.io/en/latest/api/index.html>`_
|
|
135
|
+
|
|
136
|
+
Support and source
|
|
137
|
+
==================
|
|
138
|
+
|
|
139
|
+
Use `GitHub issues <https://github.com/maxpmaxp/pdfreader/issues>`_ for bug
|
|
140
|
+
reports, questions, and feature requests. The latest source is available in the
|
|
141
|
+
`GitHub repository <https://github.com/maxpmaxp/pdfreader>`_.
|
|
142
|
+
|
|
143
|
+
References
|
|
144
|
+
==========
|
|
145
|
+
|
|
146
|
+
* `PDF 1.7 specification <https://opensource.adobe.com/dc-acrobat-sdk-docs/standards/pdfstandards/pdf/PDF32000_2008.pdf>`_
|
|
147
|
+
* `Adobe CMap and CIDFont specification <https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5014.CIDFont_Spec.pdf>`_
|
|
148
|
+
* `Adobe CMap resources <https://github.com/adobe-type-tools/cmap-resources>`_
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
=========
|
|
2
|
+
pdfreader
|
|
3
|
+
=========
|
|
4
|
+
:Info: See the `pdfreader documentation <https://pdfreader.readthedocs.io/en/latest/>`_.
|
|
5
|
+
:Author & Maintainer: Maksym Polshcha <maxp@sterch.net>
|
|
6
|
+
|
|
7
|
+
**pdfreader** is a read-only Python PDF parser for extracting text, images,
|
|
8
|
+
forms, fonts, CMaps, metadata, and other document objects. Use it when you need
|
|
9
|
+
programmatic access to PDF content and structure without editing the file or
|
|
10
|
+
rasterizing every page.
|
|
11
|
+
|
|
12
|
+
The library provides two complementary interfaces:
|
|
13
|
+
|
|
14
|
+
* ``PDFDocument`` exposes the document catalog, page tree, indirect objects,
|
|
15
|
+
streams, and metadata.
|
|
16
|
+
* ``SimplePDFViewer`` interprets page content and writes decoded data to a
|
|
17
|
+
``SimpleCanvas``.
|
|
18
|
+
|
|
19
|
+
What pdfreader provides
|
|
20
|
+
=======================
|
|
21
|
+
|
|
22
|
+
* Direct access to the document catalog, page tree, indirect objects, streams,
|
|
23
|
+
and metadata.
|
|
24
|
+
* Page-level extraction of decoded strings, images, forms, annotations, and
|
|
25
|
+
inline images through ``SimpleCanvas``.
|
|
26
|
+
* Support for password-protected documents that use a supported PDF standard
|
|
27
|
+
security handler.
|
|
28
|
+
* Conversion of supported PDF image objects to Pillow images.
|
|
29
|
+
|
|
30
|
+
pdfreader does not create, edit, split, merge, rasterize, or convert PDF files.
|
|
31
|
+
Extracted text follows content-stream order and does not automatically
|
|
32
|
+
reconstruct visual lines, columns, or tables.
|
|
33
|
+
|
|
34
|
+
PDF version compatibility
|
|
35
|
+
=========================
|
|
36
|
+
|
|
37
|
+
pdfreader targets the PDF 1.7 data model and recognizes standard
|
|
38
|
+
``%PDF-2.0`` file headers. Header recognition does not imply complete support
|
|
39
|
+
for every feature introduced by ISO 32000-2. See the
|
|
40
|
+
`PDF compatibility guide <https://pdfreader.readthedocs.io/en/latest/pdf-compatibility.html>`_
|
|
41
|
+
for the tested boundary and reporting guidance.
|
|
42
|
+
|
|
43
|
+
Installation
|
|
44
|
+
============
|
|
45
|
+
|
|
46
|
+
pdfreader is tested on Python 3.6 through Python 3.14. Install it from PyPI with
|
|
47
|
+
pip::
|
|
48
|
+
|
|
49
|
+
python -m pip install pdfreader
|
|
50
|
+
|
|
51
|
+
Quick example
|
|
52
|
+
=============
|
|
53
|
+
|
|
54
|
+
Extract decoded string fragments from the first page::
|
|
55
|
+
|
|
56
|
+
from pdfreader import SimplePDFViewer
|
|
57
|
+
|
|
58
|
+
with open("document.pdf", "rb") as stream:
|
|
59
|
+
viewer = SimplePDFViewer(stream)
|
|
60
|
+
viewer.navigate(1)
|
|
61
|
+
viewer.render()
|
|
62
|
+
text = "".join(viewer.canvas.strings)
|
|
63
|
+
|
|
64
|
+
Documentation
|
|
65
|
+
=============
|
|
66
|
+
|
|
67
|
+
* `Install or upgrade pdfreader <https://pdfreader.readthedocs.io/en/latest/installation.html>`_
|
|
68
|
+
* `Follow the tutorial <https://pdfreader.readthedocs.io/en/latest/tutorial.html>`_
|
|
69
|
+
* `Check PDF version compatibility <https://pdfreader.readthedocs.io/en/latest/pdf-compatibility.html>`_
|
|
70
|
+
* `Choose PDFDocument or SimplePDFViewer <https://pdfreader.readthedocs.io/en/latest/examples/document_vs_viewer.html>`_
|
|
71
|
+
* `Browse task-based examples <https://pdfreader.readthedocs.io/en/latest/examples/index.html>`_
|
|
72
|
+
* `Read the API reference <https://pdfreader.readthedocs.io/en/latest/api/index.html>`_
|
|
73
|
+
|
|
74
|
+
Support and source
|
|
75
|
+
==================
|
|
76
|
+
|
|
77
|
+
Use `GitHub issues <https://github.com/maxpmaxp/pdfreader/issues>`_ for bug
|
|
78
|
+
reports, questions, and feature requests. The latest source is available in the
|
|
79
|
+
`GitHub repository <https://github.com/maxpmaxp/pdfreader>`_.
|
|
80
|
+
|
|
81
|
+
References
|
|
82
|
+
==========
|
|
83
|
+
|
|
84
|
+
* `PDF 1.7 specification <https://opensource.adobe.com/dc-acrobat-sdk-docs/standards/pdfstandards/pdf/PDF32000_2008.pdf>`_
|
|
85
|
+
* `Adobe CMap and CIDFont specification <https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5014.CIDFont_Spec.pdf>`_
|
|
86
|
+
* `Adobe CMap resources <https://github.com/adobe-type-tools/cmap-resources>`_
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Releasing pdfreader
|
|
2
|
+
|
|
3
|
+
The GitHub Releases page is the only supported production release entry point.
|
|
4
|
+
Publishing a final GitHub release creates its tag and triggers the
|
|
5
|
+
`Publish release to PyPI` workflow.
|
|
6
|
+
|
|
7
|
+
## Credential and repository boundary
|
|
8
|
+
|
|
9
|
+
- Store a personal, project-scoped PyPI API token in the `PYPI_API_TOKEN`
|
|
10
|
+
repository secret.
|
|
11
|
+
- Never use an employer or other organization account, token, private package
|
|
12
|
+
index, artifact repository, or credential helper for this project.
|
|
13
|
+
- The publishing workflow installs build tools from `https://pypi.org/simple`
|
|
14
|
+
and uploads distributions only to `https://upload.pypi.org/legacy/`.
|
|
15
|
+
- Keep alpha and beta GitHub releases marked as prereleases. Prereleases do not
|
|
16
|
+
run the PyPI publishing job.
|
|
17
|
+
|
|
18
|
+
GitHub does not expose stored secret values. Before publishing, the repository
|
|
19
|
+
owner must confirm that `PYPI_API_TOKEN` contains the intended personal PyPI
|
|
20
|
+
token. Do not paste the token into an issue, pull request, workflow file, log,
|
|
21
|
+
or chat.
|
|
22
|
+
|
|
23
|
+
## Release checklist
|
|
24
|
+
|
|
25
|
+
1. Merge the release pull request after all required checks and reviews pass.
|
|
26
|
+
2. Open <https://github.com/maxpmaxp/pdfreader/releases> and select
|
|
27
|
+
**Draft a new release**.
|
|
28
|
+
3. Choose **Create new tag**, enter the exact package version such as `0.1.16`,
|
|
29
|
+
and target the current `master` branch.
|
|
30
|
+
4. Use the same version as the release title, review the generated notes, and
|
|
31
|
+
leave **Set as a pre-release** cleared for a production release.
|
|
32
|
+
5. Select **Publish release**. The workflow verifies that the tag, `setup.py`,
|
|
33
|
+
and `pdfreader.__version__` match before building and publishing.
|
|
34
|
+
6. Confirm that the `Publish release to PyPI` workflow succeeds and verify the
|
|
35
|
+
new version at <https://pypi.org/project/pdfreader/>.
|
|
36
|
+
7. Confirm that Read the Docs builds `latest` and the new release tag.
|
|
37
|
+
|
|
38
|
+
Release tags are immutable. Do not move or reuse an existing version tag. PyPI
|
|
39
|
+
release files are also immutable; inspect any partial upload before retrying a
|
|
40
|
+
failed publishing job.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:description: PDFDocument API reference for opening PDFs, iterating pages, reading metadata, and locating raw PDF objects.
|
|
3
|
+
|
|
4
|
+
PDF document structure API
|
|
5
|
+
==========================
|
|
6
|
+
|
|
7
|
+
:class:`~pdfreader.document.PDFDocument` reads the file structure and resolves
|
|
8
|
+
PDF objects lazily. Use it for catalogs, page trees, metadata, object numbers,
|
|
9
|
+
generations, and streams. It does not interpret page content operators; use
|
|
10
|
+
the :doc:`viewer` for decoded page content.
|
|
11
|
+
|
|
12
|
+
.. automodule:: pdfreader.document
|
|
13
|
+
|
|
14
|
+
.. autoclass:: pdfreader.document.PDFDocument
|
|
15
|
+
|
|
16
|
+
.. autoattribute:: root
|
|
17
|
+
.. autoattribute:: header
|
|
18
|
+
.. autoattribute:: trailer
|
|
19
|
+
|
|
20
|
+
.. autoproperty:: metadata
|
|
21
|
+
.. automethod:: pages
|
|
22
|
+
.. automethod:: build
|
|
23
|
+
.. automethod:: locate_object
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:description: pdfreader API reference for PDFDocument, SimplePDFViewer, SimpleCanvas, graphics state, resources, and PDF object types.
|
|
3
|
+
|
|
4
|
+
API reference
|
|
5
|
+
=============
|
|
6
|
+
|
|
7
|
+
The public API has three layers. Start with the layer that matches your task:
|
|
8
|
+
|
|
9
|
+
:doc:`document`
|
|
10
|
+
Use :class:`~pdfreader.document.PDFDocument` to inspect PDF structure and raw
|
|
11
|
+
objects. This is the navigation layer used by the viewer.
|
|
12
|
+
|
|
13
|
+
:doc:`viewer`
|
|
14
|
+
Use :class:`~pdfreader.viewer.SimplePDFViewer` to interpret page operators.
|
|
15
|
+
Each rendered page produces a :class:`~pdfreader.viewer.SimpleCanvas` with
|
|
16
|
+
extracted text, images, forms, and inline images.
|
|
17
|
+
|
|
18
|
+
:doc:`types`
|
|
19
|
+
Inspect the Python classes that represent catalogs, pages, streams, images,
|
|
20
|
+
forms, inline images, and content operators.
|
|
21
|
+
|
|
22
|
+
See :doc:`../examples/document_vs_viewer` for a task-based comparison before
|
|
23
|
+
working directly with these classes.
|
|
24
|
+
|
|
25
|
+
.. toctree::
|
|
26
|
+
:maxdepth: 1
|
|
27
|
+
|
|
28
|
+
document
|
|
29
|
+
viewer
|
|
30
|
+
types
|
|
31
|
+
|
|
32
|
+
Top-level imports
|
|
33
|
+
-----------------
|
|
34
|
+
|
|
35
|
+
.. automodule:: pdfreader
|
|
36
|
+
:synopsis: Read PDF structure and extract page content
|
|
37
|
+
|
|
38
|
+
.. autodata:: version
|
|
39
|
+
|
|
40
|
+
.. data:: PDFDocument
|
|
41
|
+
|
|
42
|
+
Alias for :class:`pdfreader.document.PDFDocument`.
|
|
43
|
+
|
|
44
|
+
.. data:: SimplePDFViewer
|
|
45
|
+
|
|
46
|
+
Alias for :class:`pdfreader.viewer.SimplePDFViewer`.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
.. meta::
|
|
2
|
+
:description: API reference for pdfreader catalog, page, stream, image, form, inline-image, and content-operator types.
|
|
3
|
+
|
|
4
|
+
PDF object types
|
|
5
|
+
================
|
|
6
|
+
|
|
7
|
+
These classes represent dictionaries, arrays, streams, pages, resources, and
|
|
8
|
+
content-stream objects resolved by :class:`~pdfreader.document.PDFDocument` or
|
|
9
|
+
produced while :class:`~pdfreader.viewer.SimplePDFViewer` renders a page.
|
|
3
10
|
|
|
4
11
|
.. autoclass:: pdfreader.types.objects.DictBasedObject
|
|
5
12
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:description: SimplePDFViewer and SimpleCanvas API reference for extracting decoded text, images, forms, and annotations from PDF pages.
|
|
3
|
+
|
|
4
|
+
PDF page content API
|
|
5
|
+
====================
|
|
6
|
+
|
|
7
|
+
:class:`~pdfreader.viewer.SimplePDFViewer` uses a
|
|
8
|
+
:class:`~pdfreader.document.PDFDocument` to navigate pages and interprets each
|
|
9
|
+
page's content operators. After :meth:`~pdfreader.viewer.SimplePDFViewer.render`,
|
|
10
|
+
the viewer's :attr:`~pdfreader.viewer.SimplePDFViewer.canvas` contains the
|
|
11
|
+
extracted data for the current page. Navigation resets the canvas, so render
|
|
12
|
+
again after moving to another page.
|
|
13
|
+
|
|
14
|
+
Viewer
|
|
15
|
+
------
|
|
16
|
+
|
|
17
|
+
.. autoclass:: pdfreader.viewer.SimplePDFViewer
|
|
18
|
+
|
|
19
|
+
.. autoproperty:: current_page
|
|
20
|
+
.. autoattribute:: current_page_number
|
|
21
|
+
:annotation:
|
|
22
|
+
.. autoattribute:: gss
|
|
23
|
+
:annotation:
|
|
24
|
+
.. autoattribute:: canvas
|
|
25
|
+
:annotation:
|
|
26
|
+
.. autoattribute:: resources
|
|
27
|
+
:annotation:
|
|
28
|
+
|
|
29
|
+
.. autoproperty:: metadata
|
|
30
|
+
.. automethod:: render
|
|
31
|
+
.. automethod:: navigate
|
|
32
|
+
.. automethod:: next
|
|
33
|
+
.. automethod:: prev
|
|
34
|
+
.. autoproperty:: annotations
|
|
35
|
+
.. automethod:: __iter__
|
|
36
|
+
.. automethod:: iter_pages
|
|
37
|
+
|
|
38
|
+
Canvas output
|
|
39
|
+
-------------
|
|
40
|
+
|
|
41
|
+
``strings`` contains decoded string fragments in content-stream order.
|
|
42
|
+
``grouped_strings`` preserves each text-showing operation as one group.
|
|
43
|
+
``text_content`` preserves decoded text alongside PDF content operators. None
|
|
44
|
+
of these values reconstructs visual paragraphs, columns, or tables.
|
|
45
|
+
|
|
46
|
+
.. autoclass:: pdfreader.viewer.SimpleCanvas
|
|
47
|
+
|
|
48
|
+
.. autoattribute:: text_content
|
|
49
|
+
:annotation:
|
|
50
|
+
.. autoattribute:: strings
|
|
51
|
+
:annotation:
|
|
52
|
+
.. autoattribute:: grouped_strings
|
|
53
|
+
:annotation:
|
|
54
|
+
.. autoattribute:: annotations
|
|
55
|
+
:annotation:
|
|
56
|
+
.. autoattribute:: images
|
|
57
|
+
:annotation:
|
|
58
|
+
.. autoattribute:: inline_images
|
|
59
|
+
:annotation:
|
|
60
|
+
.. autoattribute:: forms
|
|
61
|
+
:annotation:
|
|
62
|
+
.. automethod:: copy
|
|
63
|
+
|
|
64
|
+
Graphics state and resources
|
|
65
|
+
----------------------------
|
|
66
|
+
|
|
67
|
+
.. autoclass:: pdfreader.viewer.GraphicsState
|
|
68
|
+
|
|
69
|
+
.. autoattribute:: CTM
|
|
70
|
+
:annotation:
|
|
71
|
+
.. autoattribute:: LW
|
|
72
|
+
:annotation:
|
|
73
|
+
.. autoattribute:: LC
|
|
74
|
+
:annotation:
|
|
75
|
+
.. autoattribute:: LJ
|
|
76
|
+
:annotation:
|
|
77
|
+
.. autoattribute:: ML
|
|
78
|
+
:annotation:
|
|
79
|
+
.. autoattribute:: D
|
|
80
|
+
:annotation:
|
|
81
|
+
.. autoattribute:: RI
|
|
82
|
+
:annotation:
|
|
83
|
+
.. autoattribute:: I
|
|
84
|
+
:annotation:
|
|
85
|
+
.. autoattribute:: Font
|
|
86
|
+
:annotation: [font_name, font_size]
|
|
87
|
+
.. autoattribute:: Tc
|
|
88
|
+
:annotation:
|
|
89
|
+
.. autoattribute:: Tw
|
|
90
|
+
:annotation:
|
|
91
|
+
.. autoattribute:: Tz
|
|
92
|
+
:annotation:
|
|
93
|
+
.. autoattribute:: TL
|
|
94
|
+
:annotation:
|
|
95
|
+
.. autoattribute:: Tr
|
|
96
|
+
:annotation:
|
|
97
|
+
.. autoattribute:: Ts
|
|
98
|
+
:annotation:
|
|
99
|
+
|
|
100
|
+
.. autoclass:: pdfreader.viewer.GraphicsStateStack
|
|
101
|
+
|
|
102
|
+
.. autoproperty:: state
|
|
103
|
+
.. automethod:: save_state
|
|
104
|
+
.. automethod:: restore_state
|
|
105
|
+
|
|
106
|
+
.. autoclass:: pdfreader.viewer.Resources
|
|
107
|
+
|
|
108
|
+
.. autoclass:: pdfreader.viewer.PageDoesNotExist
|
|
@@ -69,10 +69,24 @@ doctest_path = [os.path.abspath('..')]
|
|
|
69
69
|
|
|
70
70
|
doctest_test_doctest_blocks = ''
|
|
71
71
|
|
|
72
|
+
samples_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'examples', 'pdfs')
|
|
73
|
+
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '_build', 'doctest-artifacts')
|
|
74
|
+
|
|
72
75
|
doctest_global_setup = """
|
|
73
76
|
|
|
74
|
-
import
|
|
77
|
+
import os.path
|
|
75
78
|
from pdfreader import PDFDocument
|
|
79
|
+
samples_dir = {!r}
|
|
80
|
+
output_dir = {!r}
|
|
81
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
82
|
+
original_cwd = os.getcwd()
|
|
83
|
+
os.chdir(output_dir)
|
|
84
|
+
|
|
85
|
+
""".format(samples_dir, output_dir)
|
|
86
|
+
|
|
87
|
+
doctest_global_cleanup = """
|
|
88
|
+
|
|
89
|
+
os.chdir(original_cwd)
|
|
76
90
|
|
|
77
91
|
"""
|
|
78
92
|
|
|
@@ -167,4 +181,4 @@ latex_documents = [
|
|
|
167
181
|
intersphinx_mapping = {
|
|
168
182
|
'gevent': ('http://www.gevent.org/', None),
|
|
169
183
|
'py': ('https://docs.python.org/3/', None),
|
|
170
|
-
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.. meta::
|
|
2
|
+
:description: Choose PDFDocument for raw PDF structure or SimplePDFViewer and SimpleCanvas for decoded page content.
|
|
3
|
+
:google-site-verification: JxOmE0CjwDilnJCbNX5DOrH78HKS6snrAxA1SGvyAzs
|
|
4
|
+
:og:title: PDFDocument or SimplePDFViewer: choose the right API
|
|
5
|
+
:og:description: Understand how pdfreader document navigation, page rendering, canvases, and extracted data fit together.
|
|
6
|
+
:og:site_name: pdfreader documentation
|
|
7
|
+
:og:type: article
|
|
8
|
+
|
|
9
|
+
Choose between PDFDocument and SimplePDFViewer
|
|
10
|
+
==============================================
|
|
11
|
+
|
|
12
|
+
pdfreader separates file structure from page-content interpretation. Both
|
|
13
|
+
interfaces are read-only, but they answer different questions.
|
|
14
|
+
|
|
15
|
+
Use PDFDocument for structure
|
|
16
|
+
-----------------------------
|
|
17
|
+
|
|
18
|
+
:class:`~pdfreader.document.PDFDocument` parses the PDF file structure. Use it
|
|
19
|
+
when you need to:
|
|
20
|
+
|
|
21
|
+
* traverse the catalog, page tree, or indirect references;
|
|
22
|
+
* inspect object numbers, generations, dictionaries, arrays, or raw streams;
|
|
23
|
+
* access resources such as fonts, CMaps, annotations, and metadata; or
|
|
24
|
+
* read content streams without interpreting their drawing and text operators.
|
|
25
|
+
|
|
26
|
+
PDFDocument resolves objects lazily and is the navigation engine used by the
|
|
27
|
+
viewer. It does not maintain graphics state or produce a canvas.
|
|
28
|
+
|
|
29
|
+
Use SimplePDFViewer for page content
|
|
30
|
+
------------------------------------
|
|
31
|
+
|
|
32
|
+
:class:`~pdfreader.viewer.SimplePDFViewer` builds on PDFDocument. Use it when
|
|
33
|
+
you need to decode and interpret the content displayed on a page:
|
|
34
|
+
|
|
35
|
+
* call :meth:`~pdfreader.viewer.SimplePDFViewer.navigate` to select a page;
|
|
36
|
+
* call :meth:`~pdfreader.viewer.SimplePDFViewer.render` to interpret its
|
|
37
|
+
content operators; and
|
|
38
|
+
* read the resulting :class:`~pdfreader.viewer.SimpleCanvas` from
|
|
39
|
+
:attr:`~pdfreader.viewer.SimplePDFViewer.canvas`.
|
|
40
|
+
|
|
41
|
+
The canvas stores decoded string fragments, text-showing groups, content-stream
|
|
42
|
+
text, image XObjects, inline images, and nested canvases rendered from form
|
|
43
|
+
XObjects. Navigation resets the current canvas, so call
|
|
44
|
+
:meth:`~pdfreader.viewer.SimpleCanvas.copy` before moving if you need to retain
|
|
45
|
+
its data. Viewer iteration returns canvas copies.
|
|
46
|
+
|
|
47
|
+
Decision guide
|
|
48
|
+
--------------
|
|
49
|
+
|
|
50
|
+
=============================== ===========================================
|
|
51
|
+
Task Start with
|
|
52
|
+
=============================== ===========================================
|
|
53
|
+
Read metadata or annotations ``PDFDocument`` or viewer properties
|
|
54
|
+
Inspect arbitrary PDF objects ``PDFDocument``
|
|
55
|
+
Locate a raw stream ``PDFDocument``
|
|
56
|
+
Extract decoded page text ``SimplePDFViewer`` and ``SimpleCanvas``
|
|
57
|
+
Extract displayed images/forms ``SimplePDFViewer`` and ``SimpleCanvas``
|
|
58
|
+
Reconstruct visual layout Canvas data plus application-specific logic
|
|
59
|
+
=============================== ===========================================
|
|
60
|
+
|
|
61
|
+
Next, choose a task from :doc:`index` or open the :doc:`../api/index`.
|