Pergunta

This sounds really simple, but I can't find a way to load a PDF into Cairo. I want to be able to do cairo.PDFSurface.create_from_pdf in the same way I do cairo.ImageSurface.create_from_png (yes I'm using the Python bindings but that's neither here nor there).

The documentation doesn't appear to give any hints.

Foi útil?

Solução

No, cairo cannot read PDFs. However, poppler can load PDFs an paint them onto a cairo context - http://poppler.freedesktop.org/

(Oh and create_from_png() is part of cairo's toy API. It works, but you are recommended to use some "real" API which can do more things than just loading PNGs)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top