python-poppler-qt4-0.24.0/0000755000175000001440000000000012471030527016133 5ustar wilbertusers00000000000000python-poppler-qt4-0.24.0/INSTALL0000644000175000001440000000320012300370344017152 0ustar wilbertusers00000000000000Installation: ============= python-poppler-qt4 installs a single Python module named 'popplerqt4'. The setup script uses distutils. Use the following commands to build and install the module: python setup.py build python setup.py install To install in /usr instead of /usr/local: python setup.py install --prefix /usr Troubleshooting: ================ The setup script uses pkg-config to determine the version of the installed poppler-qt4 library. Methods or classes that are not in the installed poppler- qt4 library will then also be disabled in the Python binding. If your system does not provide pkg-config, you can manually specify the poppler version to use with the --poppler-version option, e.g.: python setup.py build_ext --poppler-version=0.14.0 Note that for these options to work you need the 'build_ext' command rather than the 'build' command. You may then also need the --include-dirs and --library-dirs options to the build_ext command if the correct poppler-qt4 header files and libraries can't be found. See the output of python setup.py --help build_ext for more options. If you have a Debian-based system such as Ubuntu, and you get the error message "ImportError: No module named popplerqt4", try: python setup.py install --install-layout=deb See the distutils documentation for more install options. Dependencies: ============= - sip 4.9.1 or newer - poppler-qt4 0.12.0 or newer (poppler-qt4 is part of poppler) - Qt4 - PyQt4 - Python (tested with 2.6) To build the popplerqt4 module, header files of Qt4 and poppler-qt4 and sip files of PyQt4 are needed (sometimes packaged separately in corresponding -dev packages). python-poppler-qt4-0.24.0/poppler-annotation.sip0000644000175000001440000004517412470743743022526 0ustar wilbertusers00000000000000namespace Poppler { class AnnotationUtils { %TypeHeaderCode #include #include %End public: static Poppler::Annotation * createAnnotation( const QDomElement & annElement ); static void storeAnnotation( const Poppler::Annotation * ann, QDomElement & annElement, QDomDocument & document ); static QDomElement findChildElement( const QDomNode & parentNode, const QString & name ); }; // class AnnotationUtils class Annotation { %TypeHeaderCode #include #include %End public: enum SubType { AText = 1, ALine = 2, AGeom = 3, AHighlight = 4, AStamp = 5, AInk = 6, ALink = 7, ACaret = 8, AFileAttachment = 9, ASound = 10, AMovie = 11, A_BASE = 0 }; enum Flag { Hidden = 1, FixedSize = 2, FixedRotation = 4, DenyPrint = 8, DenyWrite = 16, DenyDelete = 32, ToggleHidingOnMouse = 64, External = 128 }; enum LineStyle { Solid = 1, Dashed = 2, Beveled = 4, Inset = 8, Underline = 16 }; enum LineEffect { NoEffect = 1, Cloudy = 2}; enum RevScope { Reply = 1, Group = 2, Delete = 4 }; enum RevType { None = 1, Marked = 2, Unmarked = 4, Accepted = 8, Rejected = 16, Cancelled = 32, Completed = 64 }; QString author() const; void setAuthor( const QString &author ); QString contents() const; void setContents( const QString &contents ); QString uniqueName() const; void setUniqueName( const QString &uniqueName ); QDateTime modificationDate() const; void setModificationDate( const QDateTime &date ); QDateTime creationDate() const; void setCreationDate( const QDateTime &date ); int flags() const; void setFlags( int flags ); QRectF boundary() const; void setBoundary( const QRectF &boundary ); %If(- POPPLER_V0_18_0) struct Style { // appearance properties QColor color; // black double opacity; // 1.0 // pen properties double width; // 1.0 Poppler::Annotation::LineStyle style; // LineStyle::Solid double xCorners; // 0.0 double yCorners; // 0.0 int marks; // 3 int spaces; // 0 // pen effects Poppler::Annotation::LineEffect effect; // LineEffect::NoEffect double effectIntensity; // 1.0 // default initializer Style(); }; Style style; struct Window { // window state (Hidden, FixedRotation, Deny* flags allowed) int flags; // -1 (never initialized) -> 0 (if inited and shown) // geometric properties QPointF topLeft; // no default, inited to boundary.topLeft int width; // no default int height; // no default // window contens/override properties QString title; // '' text in the titlebar (overrides author) QString summary; // '' short description (displayed if not empty) QString text; // '' text for the window (overrides annot->contents) // default initializer Window(); }; Window window; struct Revision { // child revision Poppler::Annotation * annotation; // not null // scope and type of revision Poppler::Annotation::RevScope scope; // Reply Poppler::Annotation::RevType type; // None // default initializer Revision(); }; // QLinkedList< Poppler::Annotation::Revision >& revisions(); const QLinkedList< Poppler::Annotation::Revision >& revisions() const; %End virtual SubType subType() const = 0; %If(- POPPLER_V0_18_0) virtual void store( QDomNode & parentNode, QDomDocument & document ) const; %End virtual ~Annotation(); private: Annotation(const Poppler::Annotation&); %If(POPPLER_V0_20_0 -) virtual void store( QDomNode & parentNode, QDomDocument & document ) const; %End %ConvertToSubClassCode switch (sipCpp->subType()) { case Poppler::Annotation::AText: sipType = sipType_Poppler_TextAnnotation; break; case Poppler::Annotation::ALine: sipType = sipType_Poppler_LineAnnotation; break; case Poppler::Annotation::AGeom: sipType = sipType_Poppler_GeomAnnotation; break; case Poppler::Annotation::AHighlight: sipType = sipType_Poppler_HighlightAnnotation; break; case Poppler::Annotation::AStamp: sipType = sipType_Poppler_StampAnnotation; break; case Poppler::Annotation::AInk: sipType = sipType_Poppler_InkAnnotation; break; case Poppler::Annotation::ALink: sipType = sipType_Poppler_LinkAnnotation; break; case Poppler::Annotation::ACaret: sipType = sipType_Poppler_CaretAnnotation; break; case Poppler::Annotation::AFileAttachment: sipType = sipType_Poppler_FileAttachmentAnnotation; break; case Poppler::Annotation::ASound: sipType = sipType_Poppler_SoundAnnotation; break; case Poppler::Annotation::AMovie: sipType = sipType_Poppler_MovieAnnotation; break; default: sipType = sipType_Poppler_Annotation; } %End }; // class Annotation class TextAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) TextAnnotation(); TextAnnotation( const QDomNode &node ); %End virtual ~TextAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; enum TextType { Linked, InPlace }; enum InplaceIntent { Unknown, Callout, TypeWriter }; TextType textType() const; %If(- POPPLER_V0_18_0) void setTextType( TextType type ); %End QString textIcon() const; void setTextIcon( const QString &icon ); QFont textFont() const; void setTextFont( const QFont &font ); int inplaceAlign() const; void setInplaceAlign( int align ); QString inplaceText() const; void setInplaceText( const QString &text ); QPointF calloutPoint( int id ) const; %If(- POPPLER_V0_18_0) void setCalloutPoint( int id, const QPointF &point ); %End InplaceIntent inplaceIntent() const; void setInplaceIntent( InplaceIntent intent ); private: %If(POPPLER_V0_20_0 -) TextAnnotation(); TextAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; void setTextType( TextType type ); %End TextAnnotation(const Poppler::TextAnnotation&); }; // class TextAnnotation class LineAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) LineAnnotation(); LineAnnotation( const QDomNode &node ); %End virtual ~LineAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; enum TermStyle { Square, Circle, Diamond, OpenArrow, ClosedArrow, None, Butt, ROpenArrow, RClosedArrow, Slash }; enum LineIntent { Unknown, Arrow, Dimension, PolygonCloud }; QLinkedList linePoints() const; void setLinePoints( const QLinkedList &points ); TermStyle lineStartStyle() const; void setLineStartStyle( TermStyle style ); TermStyle lineEndStyle() const; void setLineEndStyle( TermStyle style ); bool isLineClosed() const; void setLineClosed( bool closed ); QColor lineInnerColor() const; void setLineInnerColor( const QColor &color ); double lineLeadingForwardPoint() const; void setLineLeadingForwardPoint( double point ); double lineLeadingBackPoint() const; void setLineLeadingBackPoint( double point ); bool lineShowCaption() const; void setLineShowCaption( bool show ); LineIntent lineIntent() const; void setLineIntent( LineIntent intent ); private: %If(POPPLER_V0_20_0 -) LineAnnotation(); LineAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End LineAnnotation(const Poppler::LineAnnotation&); }; // class LineAnnotation class GeomAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) GeomAnnotation(); GeomAnnotation( const QDomNode &node ); %End virtual ~GeomAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; enum GeomType { InscribedSquare, InscribedCircle }; GeomType geomType() const; void setGeomType( GeomType style ); QColor geomInnerColor() const; void setGeomInnerColor( const QColor &color ); %If(- POPPLER_V0_18_0) int geomPointWidth() const; void setGeomPointWidth( int width ); %End private: %If(POPPLER_V0_20_0 -) GeomAnnotation(); GeomAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End GeomAnnotation(const Poppler::GeomAnnotation&); }; // class GeomAnnotation class HighlightAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) HighlightAnnotation(); HighlightAnnotation( const QDomNode &node ); %End virtual ~HighlightAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; enum HighlightType { Highlight, Squiggly, Underline, StrikeOut, }; struct Quad { QPointF * points { %GetCode sipPy = PyList_New(4); PyObject* obj; for (SIP_SSIZE_T i = 0; i < 4; ++i) { QPointF *point = new QPointF(sipCpp->points[i]); obj = sipConvertFromNewType(point, sipType_QPointF, NULL); PyList_SET_ITEM(sipPy, i, obj); } %End %SetCode SIP_SSIZE_T len; if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) != 4) sipErr = 1; else { for (SIP_SSIZE_T i = 0; i < 4; ++i) { PyObject *itm = PySequence_ITEM(sipPy, i); bool ok = (itm && sipCanConvertToType(itm, sipType_QPointF, SIP_NOT_NONE)); Py_XDECREF(itm); if (!ok) { sipErr = 1; break; } } } if (sipErr == 1) PyErr_SetString(PyExc_ValueError, "Quad.points must be a sequence of exactly 4 QPointF() instances"); else { int iserr = 0; for (SIP_SSIZE_T i = 0; i < 4; ++i) { PyObject *itm = PySequence_ITEM(sipPy, i); QPointF *point = reinterpret_cast(sipConvertToType(itm, sipType_QPointF, 0, 0, 0, &iserr)); sipCpp->points[i] = *point; Py_DECREF(itm); } } %End }; bool capStart; bool capEnd; double feather; }; HighlightType highlightType() const; void setHighlightType( HighlightType type ); QList< Poppler::HighlightAnnotation::Quad > highlightQuads() const; void setHighlightQuads( const QList< Poppler::HighlightAnnotation::Quad > &quads ); private: %If(POPPLER_V0_20_0 -) HighlightAnnotation(); HighlightAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End HighlightAnnotation(const Poppler::HighlightAnnotation&); }; // class HighlightAnnotation class StampAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) StampAnnotation(); StampAnnotation( const QDomNode &node ); %End virtual ~StampAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; QString stampIconName() const; void setStampIconName( const QString &name ); private: %If(POPPLER_V0_20_0 -) StampAnnotation(); StampAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End }; // class StampAnnotation class InkAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) InkAnnotation(); InkAnnotation( const QDomNode &node ); %End virtual ~InkAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; QList< QLinkedList > inkPaths() const; void setInkPaths( const QList< QLinkedList > &paths ); private: %If(POPPLER_V0_20_0 -) InkAnnotation(); InkAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End InkAnnotation(const Poppler::InkAnnotation&); }; // class InkAnnotation class LinkAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) LinkAnnotation(); LinkAnnotation( const QDomNode &node ); %End virtual ~LinkAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; enum HighlightMode { None, Invert, Outline, Push }; %If(- POPPLER_V0_18_0) Poppler::Link* linkDestionation() const; %End %If(POPPLER_V0_20_0 -) Poppler::Link* linkDestination() const; %End void setLinkDestination( Poppler::Link *link ); HighlightMode linkHighlightMode() const; void setLinkHighlightMode( HighlightMode mode ); QPointF linkRegionPoint( int id ) const; void setLinkRegionPoint( int id, const QPointF &point ); private: %If(POPPLER_V0_20_0 -) LinkAnnotation(); LinkAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End LinkAnnotation(const Poppler::LinkAnnotation&); }; // class LinkAnnotation class CaretAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) CaretAnnotation(); CaretAnnotation( const QDomNode &node ); %End virtual ~CaretAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; enum CaretSymbol { None, P }; CaretSymbol caretSymbol() const; void setCaretSymbol( CaretSymbol symbol ); private: %If(POPPLER_V0_20_0 -) CaretAnnotation(); CaretAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End CaretAnnotation(const Poppler::CaretAnnotation&); }; // class CaretAnnotation class FileAttachmentAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) FileAttachmentAnnotation(); FileAttachmentAnnotation( const QDomNode &node ); %End virtual ~FileAttachmentAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; QString fileIconName() const; void setFileIconName( const QString &icon ); Poppler::EmbeddedFile* embeddedFile() const; void setEmbeddedFile( Poppler::EmbeddedFile *ef ); private: %If(POPPLER_V0_20_0 -) FileAttachmentAnnotation(); FileAttachmentAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End FileAttachmentAnnotation(const Poppler::FileAttachmentAnnotation&); }; // class FileAttachmentAnnotation class SoundAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) SoundAnnotation(); SoundAnnotation( const QDomNode &node ); %End virtual ~SoundAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; QString soundIconName() const; void setSoundIconName( const QString &icon ); Poppler::SoundObject* sound() const; void setSound( Poppler::SoundObject *ef ); private: %If(POPPLER_V0_20_0 -) SoundAnnotation(); SoundAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End SoundAnnotation(const Poppler::SoundAnnotation&); }; // class SoundAnnotation class MovieAnnotation : Poppler::Annotation { %TypeHeaderCode #include #include %End public: %If(- POPPLER_V0_18_0) MovieAnnotation(); MovieAnnotation( const QDomNode &node ); %End virtual ~MovieAnnotation(); %If(- POPPLER_V0_18_0) virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End virtual SubType subType() const; Poppler::MovieObject* movie() const; void setMovie( Poppler::MovieObject *movie ); QString movieTitle() const; void setMovieTitle( const QString &title ); private: %If(POPPLER_V0_20_0 -) MovieAnnotation(); MovieAnnotation( const QDomNode &node ); virtual void store( QDomNode &parentNode, QDomDocument &document ) const; %End MovieAnnotation(const Poppler::MovieAnnotation&); }; // class MovieAnnotation }; // namespace Poppler /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/poppler-page-transition.sip0000644000175000001440000000172112300370344023427 0ustar wilbertusers00000000000000namespace Poppler { class PageTransition { %TypeHeaderCode #include #include %End public: enum Type { Replace = 0, Split, Blinds, Box, Wipe, Dissolve, Glitter, Fly, Push, Cover, Uncover, Fade, }; enum Alignment { Horizontal = 0, Vertical, }; enum Direction { Inward = 0, Outward, }; // PageTransition(const PageTransitionParams ¶ms); PageTransition(const Poppler::PageTransition &pt); ~PageTransition(); Type type() const; int duration() const; Alignment alignment() const; Direction direction() const; int angle() const; double scale() const; bool isRectangular() const; }; // class PageTransition }; // namespace Poppler /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/LICENSE0000644000175000001440000000146412300370344017140 0ustar wilbertusers00000000000000This binding is licensed under the GNU LGPL. Copyright (c) 2009-2010 Wilbert Berendsen (www.wilbertberendsen.nl) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA python-poppler-qt4-0.24.0/setup.cfg0000644000175000001440000000012712471030527017754 0ustar wilbertusers00000000000000[sdist] force-manifest = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 python-poppler-qt4-0.24.0/MANIFEST.in0000644000175000001440000000017712470744677017717 0ustar wilbertusers00000000000000include README.rst INSTALL LICENSE TODO ChangeLog include MANIFEST.in setup.cfg include *.py include *.sip exclude version.sip python-poppler-qt4-0.24.0/poppler-text-box.sip0000644000175000001440000000066212470743743022117 0ustar wilbertusers00000000000000namespace Poppler { class TextBox { %TypeHeaderCode #include %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 }; // namespace Poppler python-poppler-qt4-0.24.0/poppler-font-info.sip0000644000175000001440000000123712470743743022243 0ustar wilbertusers00000000000000namespace Poppler { class FontInfo { %TypeHeaderCode #include %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 }; // namespace Poppler python-poppler-qt4-0.24.0/poppler-form.sip0000644000175000001440000000617412300370344021275 0ustar wilbertusers00000000000000namespace Poppler { class FormField { %TypeHeaderCode #include #include %End public: enum FormType { FormButton, FormText, FormChoice, FormSignature, }; virtual ~FormField(); virtual FormType type() const = 0; QRectF rect() const; int id() const; QString name() const; QString uiName() const; bool isReadOnly() const; bool isVisible() const; Poppler::Link* activationAction() const; private: FormField(const Poppler::FormField&); %ConvertToSubClassCode switch (sipCpp->type()) { case Poppler::FormField::FormButton: sipType = sipType_Poppler_FormFieldButton; break; case Poppler::FormField::FormText: sipType = sipType_Poppler_FormFieldText; break; case Poppler::FormField::FormChoice: sipType = sipType_Poppler_FormFieldChoice; break; default: sipType = sipType_Poppler_FormField; } %End }; // class FormField class FormFieldButton : Poppler::FormField { %TypeHeaderCode #include #include %End public: enum ButtonType { Push, CheckBox, Radio, }; // FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w); virtual ~FormFieldButton(); virtual FormType type() const; ButtonType buttonType() const; QString caption() const; bool state() const; void setState( bool state ); QList siblings() const; private: FormFieldButton(const Poppler::FormFieldButton&); }; // class FormFieldButton class FormFieldText : Poppler::FormField { %TypeHeaderCode #include #include %End public: enum TextType { Normal, Multiline, FileSelect, }; // FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w); virtual ~FormFieldText(); virtual FormType type() const; TextType textType() const; QString text() const; void setText( const QString& text ); bool isPassword() const; bool isRichText() const; int maximumLength() const; Qt::Alignment textAlignment() const; bool canBeSpellChecked() const; private: FormFieldText(const Poppler::FormFieldText&); }; // class FormFieldText class FormFieldChoice : Poppler::FormField { %TypeHeaderCode #include #include %End public: enum ChoiceType { ComboBox, ListBox, }; // FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w); virtual ~FormFieldChoice(); virtual FormType type() const; ChoiceType choiceType() const; QStringList choices() const; bool isEditable() const; bool multiSelect() const; QList currentChoices() const; void setCurrentChoices( const QList &choice ); Qt::Alignment textAlignment() const; bool canBeSpellChecked() const; private: FormFieldChoice(const Poppler::FormFieldChoice&); }; }; // namespace Poppler /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/poppler-embedded-file.sip0000644000175000001440000000102312470743743023003 0ustar wilbertusers00000000000000namespace Poppler { class EmbeddedFile { %TypeHeaderCode #include %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 }; // namespace Poppler python-poppler-qt4-0.24.0/README.rst0000644000175000001440000000364712470744160017640 0ustar wilbertusers00000000000000================== python-poppler-qt4 ================== A Python binding for libpoppler-qt4 that aims for completeness and for being actively maintained. Created and currently maintained by Wilbert Berendsen . Homepage: https://pypi.python.org/pypi/python-poppler-qt4/ Usage:: import popplerqt4 d = popplerqt4.Poppler.Document.load('file.pdf') Documentation ------------- The Python API closely follows the Poppler Qt4 C++ interface library API, documented at http://people.freedesktop.org/~aacid/docs/qt4/ . Whereever 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 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::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: ``popplerqt4.version()`` returns the version of the ``python-poppler-qt4`` package as a tuple of ints, e.g. ``(0, 18, 2)``. ``popplerqt4.poppler_version()`` returns the version of the linked Poppler-Qt4 library as a tuple of ints, e.g. ``(0, 24, 5)``. 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. python-poppler-qt4-0.24.0/poppler-document.sip0000644000175000001440000000747712470743743022176 0ustar wilbertusers00000000000000namespace Poppler { class Document { %TypeHeaderCode #include %End public: %If(POPPLER_V0_22_0 -) enum FormType { NoForm, AcroForm, XfaForm, }; %End 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 %If(POPPLER_V0_18_0 -) TextSlightHinting = 0x00000008, %End %If(POPPLER_V0_22_0 -) OverprintPreview = 0x00000010, %End %If(POPPLER_V0_24_0 -) ThinLineSolid = 0x00000020, ThinLineShape = 0x00000040, %End }; typedef QFlags 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 fonts() const /ReleaseGIL/; %If(POPPLER_V0_22_0 -) FormType formType() const; %End Poppler::FontIterator* newFontIterator( int startPage = 0 ) const /Factory/; QByteArray fontData(const Poppler::FontInfo &font) const; QList 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 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 }; // namespace Poppler python-poppler-qt4-0.24.0/setup.py0000644000175000001440000003113712470743743017664 0ustar wilbertusers00000000000000#! python project = dict( name = 'python-poppler-qt4', version = '0.24.0', description = 'A Python binding to Poppler-Qt4', long_description = ( 'A Python binding to Poppler-Qt4 that aims for ' 'completeness and for being actively maintained. ' 'Using this module you can access the contents of PDF files ' 'inside PyQt4 applications.' ), maintainer = 'Wilbert Berendsen', maintainer_email = 'wbsoft@xs4all.nl', url = 'https://github.com/wbsoft/python-poppler-qt4', license = 'LGPL', classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Topic :: Multimedia :: Graphics :: Viewers', ], cmdclass={} ) import os import re import shlex import subprocess import sys import platform try: from setuptools import setup, Extension except ImportError: from distutils.core import setup, Extension import sipdistutils ### this circumvents a bug in sip < 4.14.2, where the file() builtin is used ### instead of open() try: import builtins try: builtins.file except AttributeError: builtins.file = open except ImportError: pass ### end def pkg_config(package, attrs=None, include_only=False): """parse the output of pkg-config for a package. returns the given or a new dictionary with one or more of these keys 'include_dirs', 'library_dirs', 'libraries'. Every key is a list of paths, so that it can be used with distutils Extension objects. """ if attrs is None: attrs = {} cmd = ['pkg-config'] if include_only: cmd += ['--cflags-only-I'] else: cmd += ['--cflags', '--libs'] cmd.append(package) try: output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] except OSError: return attrs flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'} # for python3 turn bytes back to string if sys.version_info[0] > 2: output = output.decode('utf-8') for flag in shlex.split(output): option, path = flag[:2], flag[2:] if option in flag_map: l = attrs.setdefault(flag_map[option], []) if path not in l: l.append(path) return attrs def pkg_config_version(package): """Returns the version of the given package as a tuple of ints.""" cmd = ['pkg-config', '--modversion', package] try: output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] # for python3 turn bytes back to string if sys.version_info[0] > 2: output = output.decode('utf-8') return tuple(map(int, re.findall(r'\d+', output))) except OSError: sys.stderr.write("Can't determine version of %s\n" % package) ext_args = {} pkg_config('poppler-qt4', ext_args) if 'libraries' not in ext_args: ext_args['libraries'] = ['poppler-qt4'] # hack to provide our options to sip on its invocation: build_ext_base = sipdistutils.build_ext class build_ext(build_ext_base): description = "Builds the popplerqt4 module." user_options = build_ext_base.user_options + [ ('poppler-version=', None, "version of the poppler library"), ('qmake-bin=', None, "Path to qmake binary"), ('qt-include-dir=', None, "Path to Qt headers"), ('pyqt-sip-dir=', None, "Path to PyQt's SIP files"), ('pyqt-sip-flags=', None, "SIP flags used to generate PyQt bindings") ] def initialize_options (self): build_ext_base.initialize_options(self) self.poppler_version = None self.qmake_bin = 'qmake' self.qt_include_dir = None self.pyqt_sip_dir = None self.pyqt_sip_flags = None def finalize_options (self): build_ext_base.finalize_options(self) if not self.qt_include_dir: self.qt_include_dir = self.__find_qt_include_dir() if not self.pyqt_sip_dir: self.pyqt_sip_dir = self.__find_pyqt_sip_dir() if not self.pyqt_sip_flags: self.pyqt_sip_flags = self.__find_pyqt_sip_flags() if not self.qt_include_dir: raise SystemExit('Could not find Qt4 headers. ' 'Please specify via --qt-include-dir=') if not self.pyqt_sip_dir: raise SystemExit('Could not find PyQt SIP files. ' 'Please specify containing directory via ' '--pyqt-sip-dir=') if not self.pyqt_sip_flags: raise SystemExit('Could not find PyQt SIP flags. ' 'Please specify via --pyqt-sip-flags=') self.include_dirs += (self.qt_include_dir, os.path.join(self.qt_include_dir, 'QtCore'), os.path.join(self.qt_include_dir, 'QtGui'), os.path.join(self.qt_include_dir, 'QtXml')) if self.poppler_version is not None: self.poppler_version = tuple(map(int, re.findall(r'\d+', self.poppler_version))) def __find_qt_include_dir(self): if self.pyqtconfig: return self.pyqtconfig.qt_inc_dir try: qt_version = subprocess.check_output([self.qmake_bin, '-query', 'QT_VERSION']) qt_version = qt_version.strip().decode("ascii") except (OSError, subprocess.CalledProcessError) as e: raise SystemExit('Failed to determine Qt version (%s).' % e) if not qt_version.startswith("4."): raise SystemExit('Unsupported Qt version (%s). ' 'Try specifying the path to qmake manually via ' '--qmake-bin=' % qt_version) try: result = subprocess.check_output([self.qmake_bin, '-query', 'QT_INSTALL_HEADERS']) return result.strip().decode(sys.getfilesystemencoding()) except (OSError, subprocess.CalledProcessError) as e: raise SystemExit('Failed to determine location of Qt headers (%s).' % e) def __find_pyqt_sip_dir(self): if self.pyqtconfig: return self.pyqtconfig.pyqt_sip_dir import sipconfig return os.path.join(sipconfig.Configuration().default_sip_dir, 'PyQt4') def __find_pyqt_sip_flags(self): if self.pyqtconfig: return self.pyqtconfig.pyqt_sip_flags from PyQt4 import QtCore return QtCore.PYQT_CONFIGURATION.get('sip_flags', '') @property def pyqtconfig(self): if not hasattr(self, '_pyqtconfig'): try: from PyQt4 import pyqtconfig self._pyqtconfig = pyqtconfig.Configuration() except ImportError: self._pyqtconfig = None return self._pyqtconfig def write_version_sip(self, poppler_qt4_version, python_poppler_qt4_version): """Write a version.sip file. The file contains code to make version information accessible from the popplerqt4 Python module. """ with open('version.sip', 'w') as f: f.write(version_sip_template.format( vlen = 'i' * len(python_poppler_qt4_version), vargs = ', '.join(map(format, python_poppler_qt4_version)), pvlen = 'i' * len(poppler_qt4_version), pvargs = ', '.join(map(format, poppler_qt4_version)))) def _sip_compile(self, sip_bin, source, sbf): # First check manually specified poppler version ver = self.poppler_version or pkg_config_version('poppler-qt4') or () # our own version: version = tuple(map(int, re.findall(r'\d+', project['version']))) # make those accessible from the popplerqt4 module: self.write_version_sip(ver, version) # Disable features if older poppler-qt4 version is found. # See the defined tags in %Timeline{} in poppler-qt4.sip. if not ver or ver < (0, 12, 1): tag = 'POPPLER_V0_12_0' elif ver < (0, 14, 0): tag = 'POPPLER_V0_12_1' elif ver < (0, 16, 0): tag = 'POPPLER_V0_14_0' elif ver < (0, 18, 0): tag = 'POPPLER_V0_16_0' elif ver < (0, 20, 0): tag = 'POPPLER_V0_18_0' elif ver < (0, 22, 0): tag = 'POPPLER_V0_20_0' elif ver < (0, 24, 0): tag = 'POPPLER_V0_22_0' else: tag = 'POPPLER_V0_24_0' cmd = [sip_bin] if hasattr(self, 'sip_opts'): cmd += self.sip_opts if hasattr(self, '_sip_sipfiles_dir'): cmd += ['-I', self._sip_sipfiles_dir()] if tag: cmd += ['-t', tag] cmd += [ "-c", self.build_temp, "-b", sbf, "-I", self.pyqt_sip_dir] # find the PyQt4 stuff cmd += shlex.split(self.pyqt_sip_flags) # use same SIP flags as for PyQt4 cmd.append(source) self.spawn(cmd) if platform.system() == 'Windows': # Enforce libraries to link against on Windows ext_args['libraries'] = ['poppler-qt4', 'QtCore4', 'QtGui4', 'QtXml4'] class bdist_support(): def __find_poppler_dll(self): paths = os.environ['PATH'].split(";") poppler_dll = None for path in paths: dll_path_candidate = os.path.join(path, "poppler-qt4.dll") if os.path.exists(dll_path_candidate): return dll_path_candidate return None def _copy_poppler_dll(self): poppler_dll = self.__find_poppler_dll() if poppler_dll is None: self.warn("Could not find poppler-qt4.dll in any of the folders listed in the PATH environment variable.") return False self.mkpath(self.bdist_dir) self.copy_file(poppler_dll, os.path.join(self.bdist_dir, "python-poppler4.dll")) return True import distutils.command.bdist_msi class bdist_msi(distutils.command.bdist_msi.bdist_msi, bdist_support): def run(self): if not self._copy_poppler_dll(): return distutils.command.bdist_msi.bdist_msi.run(self) project['cmdclass']['bdist_msi'] = bdist_msi import distutils.command.bdist_wininst class bdist_wininst(distutils.command.bdist_wininst.bdist_wininst, bdist_support): def run(self): if not self._copy_poppler_dll(): return distutils.command.bdist_wininst.bdist_wininst.run(self) project['cmdclass']['bdist_wininst'] = bdist_wininst import distutils.command.bdist_dumb class bdist_dumb(distutils.command.bdist_dumb.bdist_dumb, bdist_support): def run(self): if not self._copy_poppler_dll(): return distutils.command.bdist_dumb.bdist_dumb.run(self) project['cmdclass']['bdist_dumb'] = bdist_dumb try: # Attempt to patch bdist_egg if the setuptools/distribute extension is installed import setuptools.command.bdist_egg class bdist_egg(setuptools.command.bdist_egg.bdist_egg, bdist_support): def run(self): if not self._copy_poppler_dll(): return setuptools.command.bdist_egg.bdist_egg.run(self) project['cmdclass']['bdist_egg'] = bdist_egg except ImportError: pass version_sip_template = r"""// Generated by setup.py -- Do not edit PyObject *version(); %Docstring The version of the popplerqt4 python module. %End PyObject *poppler_version(); %Docstring The version of the Poppler library. %End %ModuleCode PyObject *version() {{ return Py_BuildValue("({vlen})", {vargs}); }}; PyObject *poppler_version() {{ return Py_BuildValue("({pvlen})", {pvargs}); }}; %End """ ### use full README.rst as long description with open('README.rst', 'rb') as f: project["long_description"] = f.read().decode('utf-8') project['cmdclass']['build_ext'] = build_ext setup( ext_modules = [Extension("popplerqt4", ["poppler-qt4.sip"], **ext_args)], **project ) python-poppler-qt4-0.24.0/poppler-page.sip0000644000175000001440000000455312470743743021264 0ustar wilbertusers00000000000000namespace Poppler { class Page { %TypeHeaderCode #include %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 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 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 links() const; QList annotations() const; QList formFields() const; double duration() const; QString label() const; private: Page(); Page( const Poppler::Page & ); }; // class Page }; // namespace Poppler python-poppler-qt4-0.24.0/poppler-qt4.sip0000644000175000001440000000242212470743743021051 0ustar wilbertusers00000000000000%Module(name=popplerqt4, version=0) /* * Bindings for Poppler-Qt4 to Python * Maintained by Wilbert Berendsen */ %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 POPPLER_V0_22_0 POPPLER_V0_24_0 } %ModuleHeaderCode #include %End %Include version.sip // auto-generated by the setup.py script %Include types.sip %Include poppler-annotation.sip %Include poppler-convert.sip %Include poppler-document.sip %Include poppler-embedded-file.sip %Include poppler-font-info.sip %Include poppler-font-iterator.sip %Include poppler-form.sip %Include poppler-link.sip %Include poppler-link-destination.sip %Include poppler-movie-object.sip %Include poppler-opt-content-model.sip %Include poppler-page.sip %Include poppler-page-transition.sip %Include poppler-sound-object.sip %Include poppler-text-box.sip namespace Poppler { // Functions in Poppler bool isCmsAvailable(); QDateTime convertDate (char *dateString); %If(POPPLER_V0_22_0 -) bool isOverprintPreviewAvailable(); %End }; // namespace Poppler /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/poppler-link.sip0000644000175000001440000001025612470743743021302 0ustar wilbertusers00000000000000namespace Poppler { class Link { %TypeHeaderCode #include #include %End public: Link( const QRectF &linkArea ); enum LinkType { None, Goto, Execute, Browse, Action, Sound, Movie, JavaScript, }; virtual LinkType linkType() const; virtual ~Link(); QRectF linkArea() const; private: Link(const Poppler::Link&); %ConvertToSubClassCode switch (sipCpp->linkType()) { case Poppler::Link::Goto: sipType = sipType_Poppler_LinkGoto; break; case Poppler::Link::Execute: sipType = sipType_Poppler_LinkExecute; break; case Poppler::Link::Browse: sipType = sipType_Poppler_LinkBrowse; break; case Poppler::Link::Action: sipType = sipType_Poppler_LinkAction; break; case Poppler::Link::Sound: sipType = sipType_Poppler_LinkSound; break; // (Not yet implemented upstream) // case Poppler::Link::Movie: // sipType = sipType_Poppler_LinkMovie; // break; case Poppler::Link::JavaScript: sipType = sipType_Poppler_LinkJavaScript; break; default: sipType = sipType_Poppler_Link; } %End }; // class Link class LinkGoto : Poppler::Link { %TypeHeaderCode #include #include %End public: LinkGoto( const QRectF &linkArea, QString extFileName, const Poppler::LinkDestination & destination ); ~LinkGoto(); bool isExternal() const; QString fileName() const; Poppler::LinkDestination destination() const; LinkType linkType() const; private: LinkGoto(const Poppler::LinkGoto&); }; // class LinkGoto class LinkExecute : Poppler::Link { %TypeHeaderCode #include #include %End public: QString fileName() const; QString parameters() const; LinkExecute( const QRectF &linkArea, const QString & file, const QString & params ); ~LinkExecute(); LinkType linkType() const; private: LinkExecute(const Poppler::LinkExecute&); }; // class LinkExecute class LinkBrowse : Poppler::Link { %TypeHeaderCode #include #include %End public: QString url() const; LinkBrowse( const QRectF &linkArea, const QString &url ); ~LinkBrowse(); LinkType linkType() const; private: LinkBrowse(const Poppler::LinkBrowse&); }; // class LinkBrowse class LinkAction : Poppler::Link { %TypeHeaderCode #include #include %End public: enum ActionType { PageFirst = 1, PagePrev = 2, PageNext = 3, PageLast = 4, HistoryBack = 5, HistoryForward = 6, Quit = 7, Presentation = 8, EndPresentation = 9, Find = 10, GoToPage = 11, Close = 12, }; ActionType actionType() const; LinkAction( const QRectF &linkArea, ActionType actionType ); ~LinkAction(); LinkType linkType() const; private: LinkAction(const Poppler::LinkAction&); }; // class LinkAction class LinkSound : Poppler::Link { %TypeHeaderCode #include #include %End public: LinkSound( const QRectF &linkArea, double volume, bool sync, bool repeat, bool mix, Poppler::SoundObject *sound ); virtual ~LinkSound(); LinkType linkType() const; double volume() const; bool synchronous() const; bool repeat() const; bool mix() const; Poppler::SoundObject *sound() const; private: LinkSound(const Poppler::LinkSound&); }; // class LinkSound class LinkJavaScript : Poppler::Link { %TypeHeaderCode #include #include %End public: LinkJavaScript( const QRectF &linkArea, const QString &js ); virtual ~LinkJavaScript(); LinkType linkType() const; QString script() const; private: LinkJavaScript(const Poppler::LinkJavaScript&); }; // class LinkJavaScript }; // namespace Poppler /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/PKG-INFO0000644000175000001440000000635712471030527017243 0ustar wilbertusers00000000000000Metadata-Version: 1.1 Name: python-poppler-qt4 Version: 0.24.0 Summary: A Python binding to Poppler-Qt4 Home-page: https://github.com/wbsoft/python-poppler-qt4 Author: Wilbert Berendsen Author-email: wbsoft@xs4all.nl License: LGPL Description: ================== python-poppler-qt4 ================== A Python binding for libpoppler-qt4 that aims for completeness and for being actively maintained. Created and currently maintained by Wilbert Berendsen . Homepage: https://pypi.python.org/pypi/python-poppler-qt4/ Usage:: import popplerqt4 d = popplerqt4.Poppler.Document.load('file.pdf') Documentation ------------- The Python API closely follows the Poppler Qt4 C++ interface library API, documented at http://people.freedesktop.org/~aacid/docs/qt4/ . Whereever 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 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::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: ``popplerqt4.version()`` returns the version of the ``python-poppler-qt4`` package as a tuple of ints, e.g. ``(0, 18, 2)``. ``popplerqt4.poppler_version()`` returns the version of the linked Poppler-Qt4 library as a tuple of ints, e.g. ``(0, 24, 5)``. 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. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia :: Graphics :: Viewers python-poppler-qt4-0.24.0/poppler-convert.sip0000644000175000001440000000407312300370344022006 0ustar wilbertusers00000000000000namespace Poppler { class BaseConverter { %TypeHeaderCode #include %End public: virtual ~BaseConverter(); void setOutputFileName(const QString &outputFileName); void setOutputDevice(QIODevice *device); virtual bool convert() = 0; %If(POPPLER_V0_12_1 -) enum Error { NoError, FileLockedError, OpenOutputError, NotSupportedInputFileError, }; Error lastError() const; %End private: BaseConverter(const Poppler::BaseConverter&); }; // class BaseConverter class PSConverter : Poppler::BaseConverter { %TypeHeaderCode #include %End public: enum PSOption { Printing = 0x00000001, StrictMargins = 0x00000002, ForceRasterization = 0x00000004, }; typedef QFlags PSOptions; ~PSConverter(); void setPageList(const QList &pageList); void setTitle(const QString &title); void setHDPI(double hDPI); void setVDPI(double vDPI); void setRotate(int rotate); void setPaperWidth(int paperWidth); void setPaperHeight(int paperHeight); void setRightMargin(int marginRight); void setBottomMargin(int marginBottom); void setLeftMargin(int marginLeft); void setTopMargin(int marginTop); void setStrictMargins(bool strictMargins); void setForceRasterize(bool forceRasterize); void setPSOptions(PSOptions options); PSOptions psOptions() const; bool convert(); private: PSConverter(const Poppler::PSConverter&); }; // class PSConverter class PDFConverter : Poppler::BaseConverter { %TypeHeaderCode #include %End public: enum PDFOption { WithChanges = 0x00000001, }; typedef QFlags PDFOptions; virtual ~PDFConverter(); void setPDFOptions(PDFOptions options); PDFOptions pdfOptions() const; bool convert(); private: PDFConverter(const Poppler::PDFConverter&); }; // class PDFConverter }; // namespace Poppler /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/TODO0000644000175000001440000000062712300370344016623 0ustar wilbertusers00000000000000TODO: DONE: - Poppler::Document::newFontIterator() is usable as Python iterable - Poppler::HighlightAnnotation::Quad.points has been fixed - support Poppler::InkAnnotation::inkPaths() and setInkPaths() - cast returned lists of objects like Document::links() to their respective types - convert to and from QLinkedList - test Python versions other than 2.6: 3.2.3 works - add some examples: demo.py added python-poppler-qt4-0.24.0/poppler-sound-object.sip0000644000175000001440000000120212470743743022730 0ustar wilbertusers00000000000000namespace Poppler { class SoundObject { %TypeHeaderCode #include %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 }; // namespace Poppler python-poppler-qt4-0.24.0/demo.py0000644000175000001440000000177712300370344017440 0ustar wilbertusers00000000000000import sys from PyQt4 import QtGui import popplerqt4 usage = """ Demo to load a PDF and display the first page. Usage: python demo.py file.pdf """ def pdf_view(filename): """Return a Scrollarea showing the first page of the specified PDF file.""" label = QtGui.QLabel() doc = popplerqt4.Poppler.Document.load(filename) doc.setRenderHint(popplerqt4.Poppler.Document.Antialiasing) doc.setRenderHint(popplerqt4.Poppler.Document.TextAntialiasing) page = doc.page(0) image = page.renderToImage() label.setPixmap(QtGui.QPixmap.fromImage(image)) area = QtGui.QScrollArea() area.setWidget(label) area.setWindowTitle(filename) return area def main(): app = QtGui.QApplication(sys.argv) argv = QtGui.QApplication.arguments() if len(argv) < 2: sys.stderr.write(usage) sys.exit(2) filename = argv[-1] view = pdf_view(filename) view.show() sys.exit(app.exec_()) if __name__ == "__main__": main() python-poppler-qt4-0.24.0/types.sip0000644000175000001440000001221612300370344020011 0ustar wilbertusers00000000000000/* * Various conversions that are not made by PyQt4 default. */ /** * Convert QSet * from any Python sequence and to a Python list. */ %MappedType QSet { %TypeHeaderCode #include %End %ConvertFromTypeCode // Create the list. PyObject *l; if ((l = PyList_New(sipCpp->size())) == NULL) return NULL; // Set the list elements. QSet set = *sipCpp; int i = 0; foreach (Poppler::Document::RenderBackend value, set) { PyObject *obj = PyLong_FromLong ((long) value); if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0) { Py_DECREF(l); if (obj) Py_DECREF(obj); return NULL; } Py_DECREF(obj); i++; } return l; %End %ConvertToTypeCode // Check the type if that is all that is required. if (sipIsErr == NULL) { if (!PySequence_Check(sipPy)) return 0; return 1; } QSet *qs = new QSet; for (int i = 0; i < PySequence_Size(sipPy); ++i) { Poppler::Document::RenderBackend t = (Poppler::Document::RenderBackend)PyLong_AsLong(PySequence_ITEM (sipPy, i)); *qs << t; } *sipCppPtr = qs; return sipGetState(sipTransferObj); %End }; /** * Convert QLinkedList from any sequence and to a Python list. */ template %MappedType QLinkedList { %TypeHeaderCode #include %End %ConvertFromTypeCode // Create the list. PyObject *l; if ((l = PyList_New(sipCpp->size())) == NULL) return NULL; // Set the list elements. TYPE item; QLinkedList::iterator i; int index = 0; for (i = sipCpp->begin(); i != sipCpp->end(); ++i) { TYPE *t = new TYPE(*i); PyObject *tobj; if ((tobj = sipConvertFromNewType(t, sipType_TYPE, sipTransferObj)) == NULL) { Py_DECREF(l); delete t; return NULL; } PyList_SET_ITEM(l, index, tobj); ++index; } return l; %End %ConvertToTypeCode SIP_SSIZE_T len; // Check the type if that is all that is required. if (sipIsErr == NULL) { if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) return 0; for (SIP_SSIZE_T i = 0; i < len; ++i) { PyObject *itm = PySequence_ITEM(sipPy, i); bool ok = (itm && sipCanConvertToType(itm, sipType_TYPE, SIP_NOT_NONE)); Py_XDECREF(itm); if (!ok) return 0; } return 1; } QLinkedList *qll = new QLinkedList; len = PySequence_Size(sipPy); for (SIP_SSIZE_T i = 0; i < len; ++i) { PyObject *itm = PySequence_ITEM(sipPy, i); int state; TYPE *t = reinterpret_cast(sipConvertToType(itm, sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); Py_DECREF(itm); if (*sipIsErr) { sipReleaseType(t, sipType_TYPE, state); delete qll; return 0; } qll->append(*t); sipReleaseType(t, sipType_TYPE, state); } *sipCppPtr = qll; return sipGetState(sipTransferObj); %End }; /** * Convert QList> */ template %MappedType QList< QLinkedList > { %TypeHeaderCode #include #include %End %ConvertFromTypeCode // Create the list. PyObject *l; if ((l = PyList_New(sipCpp->size())) == NULL) return NULL; const sipMappedType* qlinkedlist_type = sipFindMappedType("QLinkedList"); // Set the list elements. for (int i = 0; i < sipCpp->size(); ++i) { QLinkedList* t = new QLinkedList(sipCpp->at(i)); PyObject *tobj; if ((tobj = sipConvertFromMappedType(t, qlinkedlist_type, sipTransferObj)) == NULL) { Py_DECREF(l); delete t; return NULL; } PyList_SET_ITEM(l, i, tobj); } return l; %End %ConvertToTypeCode const sipMappedType* qlinkedlist_type = sipFindMappedType("QLinkedList"); // Check the type if that is all that is required. if (sipIsErr == NULL) { if (!PySequence_Check(sipPy)) return 0; for (int i = 0; i < PySequence_Size(sipPy); ++i) if (!sipCanConvertToMappedType(PySequence_ITEM(sipPy, i), qlinkedlist_type, SIP_NOT_NONE)) return 0; return 1; } QList< QLinkedList > *ql = new QList< QLinkedList >; for (int i = 0; i < PySequence_Size(sipPy); ++i) { int state; QLinkedList * t = reinterpret_cast< QLinkedList * >(sipConvertToMappedType(PySequence_ITEM(sipPy, i), qlinkedlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); if (*sipIsErr) { sipReleaseInstance(t, sipClass_TYPE, state); delete ql; return 0; } ql->append(*t); sipReleaseInstance(t, sipClass_TYPE, state); } *sipCppPtr = ql; return sipGetState(sipTransferObj); %End }; /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ python-poppler-qt4-0.24.0/poppler-opt-content-model.sip0000644000175000001440000000161312470743743023712 0ustar wilbertusers00000000000000namespace Poppler { class OptContentModel : QAbstractItemModel { %TypeHeaderCode #include #include %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 }; // namespace Poppler python-poppler-qt4-0.24.0/poppler-font-iterator.sip0000644000175000001440000000133712470743743023142 0ustar wilbertusers00000000000000namespace Poppler { class FontIterator { %TypeHeaderCode #include %End public: ~FontIterator(); QList next(); bool hasNext() const; int currentPage() const; Poppler::FontIterator * __iter__(); %MethodCode sipRes = sipCpp; %End SIP_PYOBJECT __next__(); %MethodCode if (sipCpp->hasNext()) { QList next = sipCpp->next(); sipRes = sipConvertFromType(&next, sipFindType("QList"), Py_None); } else { PyErr_SetNone(PyExc_StopIteration); } %End private: FontIterator(const Poppler::FontIterator&); // FontIterator( int, DocumentData *dd ); }; // class FontIterator }; // namespace Poppler python-poppler-qt4-0.24.0/poppler-movie-object.sip0000644000175000001440000000072512470743743022730 0ustar wilbertusers00000000000000namespace Poppler { class MovieObject { %TypeHeaderCode #include %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 }; // namespace Poppler python-poppler-qt4-0.24.0/poppler-link-destination.sip0000644000175000001440000000153012470743743023614 0ustar wilbertusers00000000000000namespace Poppler { class LinkDestination { %TypeHeaderCode #include #include %End public: enum Kind { destXYZ = 1, destFit = 2, destFitH = 3, destFitV = 4, destFitR = 5, destFitB = 6, destFitBH = 7, destFitBV = 8, }; LinkDestination(const QString &description); LinkDestination(const Poppler::LinkDestination &other); ~LinkDestination(); Kind kind() const; int pageNumber() const; double left() const; double bottom() const; double right() const; double top() const; double zoom() const; bool isChangeLeft() const; bool isChangeTop() const; bool isChangeZoom() const; QString toString() const; QString destinationName() const; }; // class LinkDestination }; // namespace Poppler python-poppler-qt4-0.24.0/ChangeLog0000644000175000001440000000365712470215260017716 0ustar wilbertusers00000000000000Version 0.18.3 -- * Added version() function, returning the version of python-poppler-qt4 as a tuple of ints e.g. (0, 18, 3) * Added poppler_version() function, returning the version of the Poppler- Qt4 library (if the version could be determined on build time), as a tuple of ints, e.g. (0, 24, 5). If on build time the version of Poppler-Qt4 could not be determined and was not specified, an empty tuple might be returned. Version 0.18.2 -- January 9th, 2015 * Tested with Python 2.6, 2.7, 3.2, 3.3, 3.4 * Support PyQt's new build system, contributed by Philipp Lorenz, fixing issue #6 Version 0.18.1 -- February 18th, 2014 * Tested with Python 2.6, 2.7, 3.2, 3.3 * Fix setup.py error when using Python 2.6 (issue #1) Version 0.18.0 -- February 17th, 2014 * Works with both Python 2 and Python 3 (tested: 2.6, 2.7, 3.2.3) * some API updates * fixed FormField issue * setup.py circumvents sipdistutils < 4.14.2 not working with python 3 Version 0.16.3 -- November 9th, 2012 * Enable build with Poppler 0.18 and 0.20 (new api not yet) (contributed by Marek Kašík, thanks!) * A simple demo file, inspired by a demo by Csaba Szepesvari * Better building on Windows by lorenzph * Fix for compile with Python 3.2.2 thanks to Csaba Szepesvari Version 0.16.2 -- May 20th, 2011 * Fix gcc-4.6 compile (issue #4) Version 0.16.1 -- March 21th, 2011 * Installation: fix 'sys not defined' error (issue #3) * Poppler version can now be set with build_ext --poppler-version Version 0.16.0 -- February 8th, 2011 * API updated for Poppler-0.16.0 * Version numbering on par with Poppler * Release the GIL on time-consuming calls * Poppler::FontIterator() is now also a Python iterable Version 0.1.1 -- October 28th, 2010 * poppler-qt4 API coverage complete * Add distutils-based setup.py script * Remove configure.py script * Support older poppler-qt4 versions by disabling methods not present Version 0.1.0 -- October 14th, 2010 * Initial release python-poppler-qt4-0.24.0/python_poppler_qt4.egg-info/0000755000175000001440000000000012471030527023477 5ustar wilbertusers00000000000000python-poppler-qt4-0.24.0/python_poppler_qt4.egg-info/dependency_links.txt0000644000175000001440000000000112471030525027543 0ustar wilbertusers00000000000000 python-poppler-qt4-0.24.0/python_poppler_qt4.egg-info/top_level.txt0000644000175000001440000000001312471030525026221 0ustar wilbertusers00000000000000popplerqt4 python-poppler-qt4-0.24.0/python_poppler_qt4.egg-info/PKG-INFO0000644000175000001440000000635712471030525024605 0ustar wilbertusers00000000000000Metadata-Version: 1.1 Name: python-poppler-qt4 Version: 0.24.0 Summary: A Python binding to Poppler-Qt4 Home-page: https://github.com/wbsoft/python-poppler-qt4 Author: Wilbert Berendsen Author-email: wbsoft@xs4all.nl License: LGPL Description: ================== python-poppler-qt4 ================== A Python binding for libpoppler-qt4 that aims for completeness and for being actively maintained. Created and currently maintained by Wilbert Berendsen . Homepage: https://pypi.python.org/pypi/python-poppler-qt4/ Usage:: import popplerqt4 d = popplerqt4.Poppler.Document.load('file.pdf') Documentation ------------- The Python API closely follows the Poppler Qt4 C++ interface library API, documented at http://people.freedesktop.org/~aacid/docs/qt4/ . Whereever 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 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::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: ``popplerqt4.version()`` returns the version of the ``python-poppler-qt4`` package as a tuple of ints, e.g. ``(0, 18, 2)``. ``popplerqt4.poppler_version()`` returns the version of the linked Poppler-Qt4 library as a tuple of ints, e.g. ``(0, 24, 5)``. 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. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia :: Graphics :: Viewers python-poppler-qt4-0.24.0/python_poppler_qt4.egg-info/SOURCES.txt0000644000175000001440000000115512471030526025364 0ustar wilbertusers00000000000000ChangeLog INSTALL LICENSE MANIFEST.in README.rst TODO demo.py poppler-annotation.sip poppler-convert.sip poppler-document.sip poppler-embedded-file.sip poppler-font-info.sip poppler-font-iterator.sip poppler-form.sip poppler-link-destination.sip poppler-link.sip poppler-movie-object.sip poppler-opt-content-model.sip poppler-page-transition.sip poppler-page.sip poppler-qt4.sip poppler-sound-object.sip poppler-text-box.sip setup.cfg setup.py types.sip python_poppler_qt4.egg-info/PKG-INFO python_poppler_qt4.egg-info/SOURCES.txt python_poppler_qt4.egg-info/dependency_links.txt python_poppler_qt4.egg-info/top_level.txt