[cairo] PDF text doesn't render

Lichtl, Adam alichtl at bnl.gov
Thu Sep 20 14:03:50 PDT 2007


Hello Carl,

Thank you for your response.  I would be glad to help in any way I can.  Attached are six files:

1) layers_cairo.ps   --> uses cairo_set_source_rgba, looks fine in gv
2) layers_cairo.pdf  --> using a cairo PDF surface, works in acroread and preview, but not in gv (blank) or in xpdf (opaque)
3) layers_ps2pdf.pdf --> ps2pdf on layers_cairo.ps, works in acroread, preview, gv, and xpdf, but with wrong bounding box

4) text_cairo.ps   --> uses cairo_show_text, looks fine in gv
5) text_cairo.pdf  --> using a cairo PDF surface, works in gv, xpdf, and acroread, but not in preview
6) text_ps2pdf.pdf --> ps2pdf on text_cairo.ps, works in acroread, preview, gv, and xpdf, but with wrong bounding box

In both cases the ps2pdf version is stuck into a full size page.  For the layers example, the image appears in the lower-left corner, and for the text example, the text begins in the lower left corner and is cropped at the right side of the page.

Any help, patches, or workarounds would be greatly appreciated.  Also, I would like to reiterate that cairo is an amazing framework - thank you for developing it!

Regards,
-Adam

-- 

 Adam C. Lichtl, Research Associate
 RIKEN BNL Research Center, Building 510A
 Brookhaven National Laboratory, Upton, NY 11973-5000, USA
 Tel: (631) 344-3759  Fax: (631) 344-4067  email: alichtl at bnl.gov



-----Original Message-----
From: Carl Worth [mailto:cworth at cworth.org]
Sent: Thu 9/20/2007 4:41 PM
To: Lichtl, Adam
Cc: cairo at cairographics.org
Subject: Re: [cairo] PDF text doesn't render
 
On Thu, 20 Sep 2007 16:16:56 -0400, "Lichtl, Adam" wrote:
> I'm using a Mac, and you are right- the pdf file works in gv, xpdf,
> and acroread, but not in Preview.  I wonder what is different about
> these different programs.. I thought pdf was supposed to be a
> universal format!!

It certainly would be nice, but it's definitely not the case.

All PDF viewers have bugs, (some more than others).

The best we can do in cairo is to try to emit correct PDF and also to
try to emit that subset of PDF that is most compatible across
viewers. This is very difficult to do in practice, and as cairo's PDF
output has been improving during the 1.5.x series, (more vectors and
less rasterization), the subset of the PDF language that needs to be
correctly implemented by the viewer is unfortunately increasing.

> I've also noticed that using set_source_rgba has
> different effects in different viewers - it works fine in Preview
> and acroread, but not in xpdf or gv.  This is certainly strange (and
> frustrating).

Yes, PDF viewer bugs are definitely frustrating. We do work closely
with the developers of the poppler library, (forked from the xpdf
code), to help it improve to be able to handle anything that cairo
relies on. One way we are doing that is with this tracker bug that has
dependent bugs for everything we've noticed where poppler does not yet
support some features of cairo-pdf output:

	Poppler does not yet handle everything in the cairo test suite
	https://bugs.freedesktop.org/show_bug.cgi?id=12143

> Is this going to be fixed in future versions of cairo?  It seems to
> me that the PostScript surface is perfect except for bounding box
> information, and the PDF surface just needs to implement whatever
> ps2pdf does.

We would definitely like to improve cairo's PostScript and PDF output
as much as possible. One thing that might help is if you could supply
two minimal PDF files---one that demonstrates the Preview bug and one
that avoids it.

Also, if you could mention exactly what bounding-box information is
needed by ps2pdf. If you don't know, then again, you might supply two
minimal PostScript files---one that ps2pdf likes and one that it
doesn't like.

Information like that can definitely help us in improving cairo's
output to be more resilient against viewer bugs, (and to also root out
any actual bugs in cairo's output).

-Carl


-------------- next part --------------
A non-text attachment was scrubbed...
Name: layers_cairo.pdf
Type: application/pdf
Size: 1253 bytes
Desc: layers_cairo.pdf
Url : http://lists.cairographics.org/archives/cairo/attachments/20070920/27e1e427/attachment-0004.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: layers_cairo.ps
Type: application/postscript
Size: 23801 bytes
Desc: layers_cairo.ps
Url : http://lists.cairographics.org/archives/cairo/attachments/20070920/27e1e427/attachment-0002.ps 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: layers_ps2pdf.pdf
Type: application/pdf
Size: 10072 bytes
Desc: layers_ps2pdf.pdf
Url : http://lists.cairographics.org/archives/cairo/attachments/20070920/27e1e427/attachment-0005.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_cairo.pdf
Type: application/pdf
Size: 5571 bytes
Desc: text_cairo.pdf
Url : http://lists.cairographics.org/archives/cairo/attachments/20070920/27e1e427/attachment-0006.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_cairo.ps
Type: application/postscript
Size: 13702 bytes
Desc: text_cairo.ps
Url : http://lists.cairographics.org/archives/cairo/attachments/20070920/27e1e427/attachment-0003.ps 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_ps2pdf.pdf
Type: application/pdf
Size: 4817 bytes
Desc: text_ps2pdf.pdf
Url : http://lists.cairographics.org/archives/cairo/attachments/20070920/27e1e427/attachment-0007.pdf 


More information about the cairo mailing list