frescobaldi / python-poppler-qt4

Python binding to poppler-qt4
Other
28 stars 13 forks source link

How to create annotations #14

Open cycomanic opened 8 years ago

cycomanic commented 8 years ago

Hi,

I'm trying to add an highlightannotation to a document, but I am completely stuck. It is unclear to me how to even create a highlightannotation. If I do

ann = popplerqt4.Poppler.HighlightAnnotation()

I get a type error.

TypeError: popplerqt4.HighlightAnnotation cannot be instantiated or sub-classed

I also can not find the addAnnotation method for a page.

popplerqt4.version()
Out[57]: (0, 24, 0)
In [58]: popplerqt4.poppler_version()
Out[58]: (0, 33, 0)
wbsoft commented 8 years ago

I am not sure whether the api binding is complete yet, but will look into it. An annotation seems to be instantiated using AnnotationUtils.createAnnotation, which requires a QDomElement. Be sure QtXML support is compiled in.... This thread explains some more: http://lists.freedesktop.org/archives/poppler/2012-May/009220.html