Re: copying cairo surfaces to pdf/svg surface

Maarten Bosmans <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CA+CvcKTo4te+h5mzUB7srFUmR95j7KfeGt78e_GxVu8Aj1f1kg@mail.gmail.com>
2011/11/29 Zoltán Vörös <[email protected]>:
> 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

The gdk drawable is inherently a bitmap surface, there's no way around that.

If it's your own drawing you want to save to pdf, you can use a tee
surface or a recording surface.

Maarten
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.