[cairo] Problems with cairo PDF generation and Mac OS X PDF
rendering
Malcolm Tredinnick
malcolm at pointy-stick.com
Fri Jul 7 17:43:27 PDT 2006
On Fri, 2006-07-07 at 19:48 +0200, Ryan Schmidt wrote:
> Hi again. Graphviz [1] with cairo/pango support now has the ability
> to generate PDFs for the first time, but the result is weird, in the
> following way: The PDF looks fine in Adobe Reader 7.0.8 (the latest),
> and also in Adobe Acrobat Reader 5.0.5 (almost 5 years old), but it
> looks wrong in Mac OS X 10.4.7's Preview.app 3.0.7. The PDF, and PNGs
> of how it looks in Adobe Reader and Preview, are attached.
>
> I first asked [2] on the graphviz-devel mailing list (where the
> attachments are also available, in case they don't come through on
> this list) and John Ellson, one of the Graphviz developers, suggested
> I ask here:
>
> > It looks like the viewer is having difficulty with the curve-to
> > segments of paths.
> > I would guess that if you use shape=box for the nodes that they
> > would then show up ?
> > Probably the cairo list is the place to ask first, unless there is
> > an active list for the viewer?
>
> I tried using box-shaped nodes instead of ovals, as he suggested, but
> it made no difference; the PDF still shows up great in Adobe Reader,
> and the node and edge lines are still not shown in Preview.
One thing I noticed about the PDF you attached is that it does not
follow the recommendation at the end of section 3.4.1 of the PDF spec (I
am using version 1.6 as my reference). Namely, when a PDF contains
binary data, it is recommended that the header line ("%PDF-1.4") be
immediately followed by a comment containing at least four binary
characters (with character codes >= 128). I believe ghostview in the
past had problems with PDFs that did not have this comment and did have
binary data in them as well. Although that note talks about helping file
transfer programs ("hello? The 1980's have called and want their FTP
servers back!"), it seems to affect some programs as well.
Unfortunately, because of the nature of the PDF structure (lots of byte
offset references), you can't just drop in the comment via an editor.
The generator needs to be changed.
>From a quick look at the source, this looks like a cairo problem to me:
_cairo_pdf_surface_create_for_stream_internal() in cairo-pdf-surface.c
should probably be creating the comment as well as the header.
Again, not sure if this really is the problem, but reading through the
generated PDF didn't make anything else jump out at me as immediately
wrong.
Regards,
Malcolm
More information about the cairo
mailing list