Javier Castrillo escribió:
Is there any way to view .pdf files into wxPython running on GNU /
Linux? I saw the pdfwindow in the demo but it only works in m$windows.I appreciate your help
regards
Maybe you can integrate this project within wxGTK:
https://launchpad.net/poppler-python
Basically, it allows to call Poppler (the PDF rendering engine behind Evince, Okular, etc.) from Python. It even comes with an pyGTK demo app:
It seems to depend on a Cairo drawing context to do the rendering, not really in PyGTK (the library used in the example):
def __init__(self):
[...]
self.document = poppler.document_new_from_file (uri, None)
self.n_pages = self.document.get_n_pages()
self.current_page = self.document.get_page(0)
self.scale = 1
self.width, self.height = self.current_page.get_size()
[...]
self.dwg = gtk.DrawingArea()
self.dwg.set_size_request(int(self.width), int(self.height))
self.dwg.connect("expose-event", self.on_expose)
[...]
def on_expose(self, widget, event):
cr = widget.window.cairo_create()
cr.set_source_rgb(1, 1, 1)
if self.scale != 1:
cr.scale(self.scale, self.scale)
cr.rectangle(0, 0, self.width, self.height)
cr.fill()
self.current_page.render(cr)
And you can use Cairo from wxPython:
http://wiki.wxpython.org/UsingCairoWithWxPython
So, (anyone else can give some more hints here) I think you can use python-poppler to render a PDF in a Cairo Drawing Context. I compiled it myself and it seems to works fine.
Just one more thing, python-poppler requires a recent version of libpoppler (>= 0.10), I had to compile it too (Ubuntu 8.10 comes with libpoppler 0.8.x), but the process was without hitches.
Ubuntu 9.04 (now in beta) has libpoppler 0.10.x.
If you have the time to test this, please answer in this thread.
Regards, (Saludos!)
Marcelo
···
--
Marcelo F. Fernández
Buenos Aires, Argentina
Licenciado en Sistemas - CCNA
E-Mail: fernandezm22@yahoo.com.ar
Jabber ID: fernandezm22@jabber.org
Public Key ID: 5C990A6C 111C3661
Blog: http://marcelosoft.blogspot.com