[pygtk] Display PostScript files in PyGTK without conversion?

Kevin Milner kmilner at usc.edu
Wed Nov 7 11:25:23 WST 2007


After spending a lot of time following leads, and often thinking that I 
was very close, I gave up. I thought that cairo could do what I wanted, 
but I believe (correct me if I'm wrong) that PSSurface can write the 
contents of a cairo context which is displayed on a gtk.DrawingArea to a 
PS file (or a PDF through PDFSurface), but that it cannot be used to 
actually display PS files onto a gtk.DrawingArea. Chris, please keep me 
updated if you find a solution and I'll do the same (as the method to 
display PS files and PDF files is probably similar).

Kevin

Chris Cole wrote:
> Donn wrote:
>>> however I would need a way
>>> to display PostScript files.
>>
>> I hear that Cairo (pyCairo) can do stuff with postscript as well as 
>> pdf. You should def. play around with it.
>
> You're right cairo does do some stuff with postscript and pdf but I'm 
> running into the same problem. After a little searching I know you can 
> something like:
>
> >>> import cairo
> >>> surface = cairo.PDFSurface('foo.pdf', 300, 600)
> >>> context = cairo.Context(surface)
> >>>
>
> but I'm not really sure how to display a cairo context or surface inside
> gtk. I'm guessing you have to use a gtk.DrawingArea or something like 
> that but I haven't been able to figure it out...
>
> Any help would be greatly appreciated.
>
> Thanks,
>   Chris
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


More information about the pygtk mailing list