绑定到poppler-qt4的python
python-poppler-qt4的Python项目详细描述
libpoppler-qt4的一个python绑定,目的是实现完整性和 积极维护。
由wilbert berendsen<;wbsoft@xs4all.nl>;创建和当前维护。
主页:https://pypi.python.org/pypi/python-poppler-qt4/
用法:
import popplerqt4 d = popplerqt4.Poppler.Document.load('file.pdf')
文档
Python API紧跟Popter QT4 C++接口库API, 记录在http://people.freedesktop.org/~aacid/docs/qt4/。
C++的API需要^ {TT1} $,^ {Tt2} $或^ {TT3}$,任何 可以使用python序列。 api调用返回QList、QSet或QLinkedListall返回python 名单。
有一些不同:
Poppler::Document::getPdfVersion(int *major, int *minor)可以是 称为d.getPdfVersion(),(其中d是Poppler::Document 实例);它将返回一个由两个整数组成的元组(major、minor)。
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名称空间之外,还有两个顶级模块 功能:
- ^{tt15}$
- returns the version of the ^{tt16}$ package as a tuple of ints, e.g. ^{tt17}$.
- ^{tt18}$
returns the version of the linked Poppler-Qt4 library as a tuple of ints, e.g. ^{tt19}$.
This is determined at build time. If at build time the Poppler-Qt4 version could not be determined and was not specified, an empty tuple might be returned.