[cairo] Problem with png in pdf documents when using acroread

Davide Viti zinosat at tiscali.it
Wed Apr 4 10:41:52 PDT 2007


I have a problem when including a png image in a PDF document which
shows up when using Acrobat Reader, but not with evince / xpdf:
the rectangle gets drawn in the first page but not in the following pages.

If you remove the block of code that draws the png image, the problem
disappears. Note also that if you draw the png first, and then draw the
rectangle, the problem reproduces on all pages (including the first).

I've reproduced this both with the cairo package included in debian
unstable (1.2.4) and with the 1.4.2 snapshot.

I narrowed down the testcase to the code snippet at the bottom of this message.
In case anyone wanted to see directly the pdf file, you can find it in [1] (~7 Kb)

It's probably a problem with Acrobat Reader but it'd be nice if it'd be
possible to workaround it somehow maybe making sure the pdf backend
produce acroread-friendly files.

TIA,
Davide

[1] http://www.webalice.it/zinosat/testme.pdf

/* ------ code snippet ------ */
#include <cairo.h>
#include <cairo-pdf.h>

int 
main (int argc, char **argv)
{
  int i;
  cairo_surface_t *surface;
  cairo_t *cr;
  cairo_surface_t *image;

  surface = cairo_pdf_surface_create ("testme.pdf", 4.0*72, 4.0*72);    
  cr = cairo_create (surface);
  cairo_surface_destroy (surface);
  cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);

  for (i = 0; i < 2; i++)
    {
      cairo_rectangle(cr, 100, 100, 150, 150 );
      cairo_stroke(cr);

      image = cairo_image_surface_create_from_png ("logo.png");
      cairo_set_source_surface (cr, image, 30, 30);
      cairo_paint (cr);
      cairo_show_page(cr);
    }
  cairo_destroy (cr);
  return 0;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070404/f7c05425/attachment.pgp


More information about the cairo mailing list