[cairo] Cairo PDF output doesn't render in Acrobat
Nick De Roeck
nick.de.roeck at gmail.com
Mon Apr 21 07:58:53 PDT 2008
Hi,
First of all my sincere admiration for all your nice work with Cairo.
This library is fantastic!
I've got an issue with the PDF output of Cairo 1.6.4. If you run the
code below you'll end up with a PDF file (in attachment) which doesn't
render in Acrobat (8.1.2), with the error: 'a drawing error occured'.
I've tested this file also with OSX 1.5.2 Preview.app, which displays
the file just fine.
My guess is that this is related to the multistep gradation, if you
leave out the middle step, the PDF file renders fine in Acrobat.
I'm not sure if this is a bug in Acrobat, or a bug in the PDF itself.
All insights very welcome,
Kind regards,
Nick.
--- code:
// setup
cairo_surface_t *lCairoSurface =
cairo_pdf_surface_create("cairotest.pdf",300,300);
cairo_t *lCairoState = cairo_create(lCairoSurface);
// path
cairo_new_path(lCairoState);
cairo_move_to(lCairoState,34.48,0.5);
cairo_rectangle(lCairoState,10,10,100,100);
cairo_close_path(lCairoState);
// multi-step radial gradient
cairo_pattern_t
*lPattern=cairo_pattern_create_radial(52.5937,46.3297,0,52.5937,46.3297,53.3345);
cairo_pattern_add_color_stop_rgba(lPattern,0,1,1,0,1);
cairo_pattern_add_color_stop_rgba(lPattern,0.522222,1,0.8,0,1);
cairo_pattern_add_color_stop_rgba(lPattern,0.988889,1,0.6,0,1);
// paint
cairo_set_source(lCairoState,lPattern);
cairo_fill_preserve(lCairoState);
// clean-up
cairo_pattern_destroy(lPattern);
cairo_surface_flush(lCairoSurface);
cairo_surface_finish(lCairoSurface);
cairo_surface_destroy(lCairoSurface);
cairo_destroy(lCairoState);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairotest.pdf
Type: application/pdf
Size: 1842 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080421/333561b4/attachment.pdf
More information about the cairo
mailing list