19 March 2010

PyPoppler, PDF rendering in Pythonic way

PyPoppler viewing Blender Wiki Manual PDF

Poppler Library has been used by Inkscape and GIMP to render PDF document nicely. PyPoppler is a bindings to Python using PyGTK for its user interface. It's analogue to PyWebkitGTK.

In this PDF reader screenshot, pypoppler demonstrate simple page and zoom control. In my test, rendering speed is quite responsive compared to Acrobat for pdf document with light graphics and rich text. But when handling pdf with rich layered graphics (that contain transparency), it starts to choked up though. Also it seems the demo fail to recognize page width & height (clip box?) correctly in some case, that's it drawn a smaller white rectangle like shown in 2nd shot and notice how scrollbars are missing there while inkscape correctly import the page with the same poppler.

Nonetheless this is probably the fastest way to integrate a PDF previewer or reader in your python apps rather than calling acrobat that might not installed, especially if you also using PyGTK. Or it could become a neat internal help/manual viewer (alternative to CHM eh?), hmm.. as long as it searchable :-).



This is unofficial, not heavily tested win32 binary for Python 2.6. Since min. required pycairo is 1.8.4, it's not possible for Python 2.5 :(

License: GPL

Binaries:
PyGTK AIO Installer or
poppler-0.15.0 with python 2.5-2.7 binding

Dependencies:
At least GTK 2.16 and Glib 2.24
Poppler-0.14.0 (Unofficial)
Python 2.5
PyCairo 1.8.6
PyGTK 2.16
PyGObject 2.20

demo
For opening Unicode PDF you might need Poppler data, extract files in poppler-data-0.4.0 folder into GTK's share\poppler folder (create if not exist)

4 comments:

  1. I got all dependency installed by still get the message 'DLL load failed'
    any ideas? thanks.

    ReplyDelete
  2. Link to poppler-0.15.0 with python bindings not working! Can you upload again? It's very important to me

    ReplyDelete
    Replies
    1. you need particular 0.15 version? otherwise just use the installer link

      Delete
  3. I need poppler for python 2.7 and gtk 2.24.

    ReplyDelete