[cairo] copying cairo surfaces to pdf/svg surface

Zoltán Vörös zvoros at gmail.com
Tue Nov 29 14:16:35 PST 2011


Hi All,

I have a cairo surface that is implemented as a gdk drawable, and I 
would like to save the content as a pdf file. However, if I do this

             surface = cairo.PDFSurface('pdffile.pdf', 800, 1200);
             cairo_ctx = cairo.Context(surface)
             cairo_ctx.set_source_surface(drawable_surface, 0, 0)
             cairo_ctx.paint()
             cairo_ctx.show_page()

then the output looks grainy, and it seems as if the content was saved 
as a bitmap image, and not as a vector file. (The drawable is about 400 
times 500 pixels large, but it does not really matter). My question is 
whether it is possible to force cairo to take the drawable_surface's 
content as a set of vector objects, or I have to re-draw the content to 
the pdf surface?
Thanks,
Zoltán


More information about the cairo mailing list