A Python binding to Poppler-Qt5
Project description
A Python binding for libpoppler-qt5 that aims for completeness and for being actively maintained.
Created and maintained by Wilbert Berendsen <wbsoft@xs4all.nl>, with help of other contributors, especially where it concerns supporting many platforms and build systems. Thanks for everyone’s help!
Homepage: https://pypi.python.org/pypi/python-poppler-qt5/
Usage:
import popplerqt5 d = popplerqt5.Poppler.Document.load('file.pdf')
Documentation
The Python API closely follows the Poppler Qt5 C++ interface library API, documented at https://poppler.freedesktop.org/api/qt5/ .
Note: Releases of PyQt5 < 5.4 currently do not support the QtXml module, all methods that use the QDomDocument, QDomElement and QDomNode types are disabled. This concerns the Document::toc() method and some constructors and the store() methods in the Annotation subclasses. So, using PyQt5 >= 5.4 is recommended.
Wherever the C++ API requires QList, QSet or QLinkedList, any Python sequence can be used. API calls that return QList, QSet or QLinkedList all return Python lists.
There are a few other differences:
Poppler::Document::getPdfVersion(int *major, int *minor) can simply be called as d.getPdfVersion(), (where d is a Poppler::Document instance); it will return a tuple of two integers (major, minor).
Poppler::Document has __len__ and __getitem__ methods, corresponding to numPages() and page(int num).
Poppler::FontIterator (returned by Poppler::Document::newFontIterator) is also a Python iterable (e.g. has __iter__() and __next__() methods). So although you can use:
it = document.newFontIterator() while it.hasNext(): fonts = it.next() # list of FontInfo objects ...
you can also use the more Pythonic:
for fonts in document.newFontIterator(): ...
In addition to the Poppler namespace, there are two toplevel module functions:
- popplerqt5.version()
returns the version of the python-poppler-qt5 package as a tuple of ints, e.g. (0, 18, 2).
- popplerqt5.poppler_version()
returns the version of the linked Poppler-Qt5 library as a tuple of ints, e.g. (0, 24, 5).
This is determined at build time. If at build time the Poppler-Qt5 version could not be determined and was not specified, an empty tuple might be returned.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file python-poppler-qt5-21.3.0.tar.gz
.
File metadata
- Download URL: python-poppler-qt5-21.3.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b477e8841f0ea0e09fdab6f2f305cf38df977d9e142e5693a374605d75dd6fe0 |
|
MD5 | 99c72b0a2043dfc7d5b92e0f167be4b2 |
|
BLAKE2b-256 | 2935cf515357cd968a99e404da6dddc2c292b5ced40b808b6ec3c86623b612e9 |