1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
|
%Module popplerqt4 0
%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
%Import QtXml/QtXmlmod.sip
%Timeline {
POPPLER_V0_12_0
POPPLER_V0_12_1
POPPLER_V0_14_0
POPPLER_V0_16_0
POPPLER_V0_18_0
POPPLER_V0_20_0
}
%Include types.sip
%Include poppler-link.sip
%Include poppler-form.sip
%Include poppler-annotation.sip
%Include poppler-convert.sip
%Include poppler-page-transition.sip
%ModuleHeaderCode
#include <qt4/poppler-qt4.h>
%End
/*
* Bindings for Poppler-Qt4 to Python
* Maintained by Wilbert Berendsen <wbsoft@xs4all.nl>
*/
namespace Poppler {
class Document {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
enum PageMode {
UseNone,
UseOutlines,
UseThumbs,
FullScreen,
UseOC,
UseAttach,
};
enum PageLayout {
NoLayout,
SinglePage,
OneColumn,
TwoColumnLeft,
TwoColumnRight,
TwoPageLeft,
TwoPageRight,
};
enum RenderBackend {
SplashBackend,
ArthurBackend,
};
enum RenderHint {
Antialiasing = 0x00000001,
TextAntialiasing = 0x00000002,
%If(POPPLER_V0_12_1 -)
TextHinting = 0x00000004,
%End
};
typedef QFlags<Poppler::Document::RenderHint> RenderHints;
void setColorDisplayProfile(void *outputProfileA);
void setColorDisplayProfileName(const QString &name);
void* colorRgbProfile() const;
void* colorDisplayProfile() const;
static Poppler::Document *load(const QString & filePath,
const QByteArray &ownerPassword=QByteArray(),
const QByteArray &userPassword=QByteArray()) /Factory, ReleaseGIL/;
static Poppler::Document *loadFromData(const QByteArray &fileContents,
const QByteArray &ownerPassword=QByteArray(),
const QByteArray &userPassword=QByteArray()) /Factory, ReleaseGIL/;
Poppler::Page *page(int index) const /Factory/;
Poppler::Page *page(const QString &label) const /Factory/;
int numPages() const;
PageMode pageMode() const;
PageLayout pageLayout() const;
bool unlock(const QByteArray &ownerPassword, const QByteArray &userPassword);
bool isLocked() const;
QDateTime date( const QString & data ) const;
QString info( const QString & data ) const;
QStringList infoKeys() const;
bool isEncrypted() const;
bool isLinearized() const;
bool okToPrint() const;
bool okToPrintHighRes() const;
bool okToChange() const;
bool okToCopy() const;
bool okToAddNotes() const;
bool okToFillForm() const;
bool okToCreateFormFields() const;
bool okToExtractForAccessibility() const;
bool okToAssemble() const;
%If(POPPLER_V0_16_0 -)
bool getPdfId(QByteArray *permanentId, QByteArray *updateId) const;
%End
void getPdfVersion(int *major, int *minor) const;
QList<Poppler::FontInfo> fonts() const /ReleaseGIL/;
Poppler::FontIterator* newFontIterator( int startPage = 0 ) const /Factory/;
QByteArray fontData(const Poppler::FontInfo &font) const;
QList<Poppler::EmbeddedFile*> embeddedFiles() const;
bool hasEmbeddedFiles() const;
QDomDocument *toc() const;
Poppler::LinkDestination *linkDestination( const QString &name ) /Factory, ReleaseGIL/;
void setPaperColor(const QColor &color);
QColor paperColor() const;
void setRenderBackend( RenderBackend backend );
RenderBackend renderBackend() const;
static QSet<Poppler::Document::RenderBackend> availableRenderBackends();
void setRenderHint( RenderHint hint, bool on = true );
RenderHints renderHints() const;
Poppler::PSConverter *psConverter() const /Factory/;
Poppler::PDFConverter *pdfConverter() const /Factory/;
QString metadata() const;
bool hasOptionalContent() const;
Poppler::OptContentModel *optionalContentModel() /Factory/;
QStringList scripts() const;
private:
Document();
Document(const Poppler::Document &);
}; // class Document
class Page {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
~Page();
enum Rotation {
Rotate0 = 0,
Rotate90 = 1,
Rotate180 = 2,
Rotate270 = 3,
};
enum PageAction {
Opening,
Closing,
};
%If(POPPLER_V0_16_0 -)
enum TextLayout {
PhysicalLayout,
RawOrderLayout,
};
enum PainterFlag {
DontSaveAndRestore = 0x00000001,
};
typedef QFlags<Poppler::Page::PainterFlag> PainterFlags;
%End
QImage renderToImage(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate = Rotate0) const /ReleaseGIL/;
%If(POPPLER_V0_16_0 -)
bool renderToPainter(QPainter* painter, double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1,
Rotation rotate = Rotate0, PainterFlags flags = 0) const /ReleaseGIL/;
%End
QImage thumbnail() const;
%If(POPPLER_V0_16_0 -)
QString text(const QRectF &rect, TextLayout textLayout) const;
%End
QString text(const QRectF &rect) const;
enum SearchDirection {
FromTop,
NextResult,
PreviousResult,
};
enum SearchMode {
CaseSensitive,
CaseInsensitive,
};
bool search(const QString &text, QRectF &rect, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const /ReleaseGIL/;
%If(POPPLER_V0_14_0 -)
bool search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const /ReleaseGIL/;
%End
QList<Poppler::TextBox*> textList(Rotation rotate = Rotate0) const;
QSizeF pageSizeF() const;
QSize pageSize() const;
Poppler::PageTransition *transition() const;
Poppler::Link *action( PageAction act ) const;
enum Orientation {
Landscape,
Portrait,
Seascape,
UpsideDown,
};
Orientation orientation() const;
void defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown);
QList<Poppler::Link*> links() const;
QList<Poppler::Annotation*> annotations() const;
QList<Poppler::FormField*> formFields() const;
double duration() const;
QString label() const;
private:
Page();
Page( const Poppler::Page & );
}; // class Page
class TextBox {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
TextBox(const QString& text, const QRectF &bBox);
~TextBox();
QString text() const;
QRectF boundingBox() const;
Poppler::TextBox *nextWord() const;
QRectF charBoundingBox(int i) const;
bool hasSpaceAfter() const;
private:
TextBox(const Poppler::TextBox&);
}; // class TextBox
class FontInfo {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
enum Type {
unknown,
Type1,
Type1C,
Type1COT,
Type3,
TrueType,
TrueTypeOT,
CIDType0,
CIDType0C,
CIDType0COT,
CIDTrueType,
CIDTrueTypeOT,
};
FontInfo();
// FontInfo( const FontInfoData &fid );
FontInfo( const Poppler::FontInfo &fi );
~FontInfo();
QString name() const;
QString file() const;
bool isEmbedded() const;
bool isSubset() const;
Type type() const;
QString typeName() const;
}; // class FontInfo
class FontIterator {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
~FontIterator();
QList<Poppler::FontInfo> next();
bool hasNext() const;
int currentPage() const;
Poppler::FontIterator * __iter__();
%MethodCode
sipRes = sipCpp;
%End
SIP_PYOBJECT __next__();
%MethodCode
if (sipCpp->hasNext()) {
QList<Poppler::FontInfo> next = sipCpp->next();
sipRes = sipConvertFromType(&next, sipFindType("QList<Poppler::FontInfo>"), Py_None);
} else {
PyErr_SetNone(PyExc_StopIteration);
}
%End
private:
FontIterator(const Poppler::FontIterator&);
// FontIterator( int, DocumentData *dd );
}; // class FontIterator
class EmbeddedFile {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
// EmbeddedFile(EmbFile *embfile);
~EmbeddedFile();
QString name() const;
QString description() const;
int size() const;
QDateTime modDate() const;
QDateTime createDate() const;
QByteArray checksum() const;
QString mimeType() const;
QByteArray data();
bool isValid() const;
private:
EmbeddedFile(const Poppler::EmbeddedFile&);
}; // class EmbeddedFile
class SoundObject {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
enum SoundType {
External,
Embedded,
};
enum SoundEncoding {
Raw,
Signed,
muLaw,
ALaw,
};
// SoundObject(Sound *popplersound);
~SoundObject();
SoundType soundType() const;
QString url() const;
QByteArray data() const;
double samplingRate() const;
int channels() const;
int bitsPerSample() const;
SoundEncoding soundEncoding() const;
private:
SoundObject(const Poppler::SoundObject&);
}; // class SoundObject
class MovieObject {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
%End
public:
enum PlayMode {
PlayOnce,
PlayOpen,
PlayRepeat,
PlayPalindrome,
};
~MovieObject();
QString url() const;
QSize size() const;
int rotation() const;
bool showControls() const;
PlayMode playMode() const;
private:
MovieObject(const Poppler::MovieObject&);
}; // class MovieObject
class OptContentModel : QAbstractItemModel {
%TypeHeaderCode
#include <qt4/poppler-qt4.h>
#include <qt4/poppler-optcontent.h>
%End
public:
virtual ~OptContentModel();
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
Qt::ItemFlags flags ( const QModelIndex & index ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
private:
OptContentModel(const Poppler::OptContentModel&);
}; // class OptContentModel
// Functions in Poppler
bool isCmsAvailable();
QDateTime convertDate (char *dateString);
}; // namespace Poppler
/* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */
|