绑定到poppler-qt5的python
python-poppler-qt5的Python项目详细描述
libpoppler-qt5的一个python绑定,其目标是完整性和 积极维护。
由wilbert berendsen<;wbsoft@xs4all.nl>;创建和当前维护。
主页:https://pypi.python.org/pypi/python-poppler-qt5/
用法:
import popplerqt5 d = popplerqt5.Poppler.Document.load('file.pdf')
文档
Python API紧跟PopQuter Qt5 C++接口库API, 记录在http://people.freedesktop.org/~aacid/docs/qt5/。
注意:Pyqt5<;5.4版本当前不支持qtXML模块, 使用qdomdocument、qdomelement和qdomnode类型的所有方法都是 已禁用。这涉及到Document::toc()方法和一些构造函数 以及Annotation子类中的store()方法。所以,使用 建议Pyqt5>;=5.4。
C++的API需要^ {TT4} $,^ {Tt5} $或^ {TT6}$,任何 可以使用python序列。 api调用返回QList、QSet或QLinkedListall返回python 名单。
还有其他一些区别:
Poppler::Document::getPdfVersion(int *major, int *minor)可以是 称为d.getPdfVersion(),(其中d是Poppler::Document 实例);它将返回一个由两个整数组成的元组(major、minor)。
Poppler::Document有__len__和__getitem__方法,对应 到numPages()和page(int num)。
Poppler::FontIterator(由Poppler::Document::newFontIterator返回) 也是一个python iterable(例如有__iter__()和__next__()方法)。 因此,尽管您可以使用:
it = document.newFontIterator() while it.hasNext(): fonts = it.next() # list of FontInfo objects ...
您也可以使用更具Python性的:
for fonts in document.newFontIterator(): ...
除了poppler名称空间之外,还有两个顶级模块 功能:
- ^{tt23}$
- returns the version of the ^{tt24}$ package as a tuple of ints, e.g. ^{tt25}$.
- ^{tt26}$
returns the version of the linked Poppler-Qt5 library as a tuple of ints, e.g. ^{tt27}$.
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.