[cairo] PDF backend: PDF trailer not written?

Adrian Johnson ajohnson at redneon.com
Tue Dec 2 02:04:33 PST 2008


Sascha Steinbiss wrote:
> Adrian Johnson wrote:
>> An incomplete PDF file is a result of an error occurring while creating 
>> the PDF. You can check the surface status to find out what went wrong.
>>
>> For example:
>>
>>   cairo_surface_finish (surface);
>>   status = cairo_surface_status (surface);
>>   cairo_surface_destroy (surface);
>>   printf("%s\n", cairo_status_to_string (status));
> 
> Thanks. I actually tried that before after each page and drawing 
> operation set (which reported "success"), but not after the 
> cairo_surface_finish() call. Doing so now reports "input string not 
> valid UTF-8".

All the font subsetting occurs in the call to cairo_surface_finish() so 
it is useful to check the error after finish and before destroying the 
surface.

> I suppose this does not refer to any text drawn via cairo_show_text()? 
> Any text I draw is read from a properly UTF8-encoded file. So what 
> "input string" does this message refer to, and why doesn't it seem to 
> cause a problem in the older version?

It could be something to do with the glyph to unicode mapping that is 
embedded with each font to facilitate copy and pasting text from PDFs.

It would be useful to get a stack trace when the error occurs. You can 
do this by compiling cairo with debug enabled then running your 
application in gdb with a breakpoint set on _cairo_error().

> 
> Sascha
> 




More information about the cairo mailing list