Bug 14470

Summary: pdf generated with nothing in them
Product: cairo Reporter: Charles Doutriaux <doutriaux1>
Component: pdf backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.5.8   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: C code that will produce the bad pdf.
Minimal version
my none readable pdf file

Description Charles Doutriaux 2008-02-12 07:19:07 UTC
Created attachment 14285 [details]
C code that will produce the bad pdf.

I'm attaching a C code, that "Should" generate a pdf file with a red rectangle and a "hi" written in it.

X11 works, png works, ps works, but the pdf backend seems to fail.

I've built PDFlib-Lite-7.0.2.tar.gz as my libpdf, i'm on a Linux box:
2.6.9-55.0.2.EL #1 Tue Jun 12 17:47:10 EDT 2007 i686 i686 i386 GNU/Linux
gcc:4.2.1
But i've reproduced this on Mac OS X 10.4 as well and a lot of other linux platform.

Am i using the wrong pdf lib ?

Thx,

C.
Comment 1 Chris Wilson 2008-02-12 08:02:20 UTC
Created attachment 14287 [details]
Minimal version

I ran your test code against 1.5.8 and git, and observed "hi" on top of a red rectangle as expected.

I then trimmed your example to produce the hopefully minimal test case - and in doing so spotted a missing fclose() that could explain why your pdf is blank. Does this updated test case still fail for you, or does simply adding an fclose() to the original test code fix the pdf output?
Comment 2 Charles Doutriaux 2008-02-12 08:49:40 UTC
Yes even with that I can't see the pdf file, neither on my linux or my 
mac box.
Could it be libpdf form pdflite that's wrong?

I'm attaching the pdf file i generate to see if you can see it.

C.

bugzilla-daemon@freedesktop.org wrote:
> http://bugs.freedesktop.org/show_bug.cgi?id=14470
>
>
>
>
>
> --- Comment #1 from Chris Wilson <chris@chris-wilson.co.uk>  2008-02-12 08:02:20 PST ---
> Created an attachment (id=14287)
>  --> (http://bugs.freedesktop.org/attachment.cgi?id=14287)
> Minimal version
>
> I ran your test code against 1.5.8 and git, and observed "hi" on top of a red
> rectangle as expected.
>
> I then trimmed your example to produce the hopefully minimal test case - and in
> doing so spotted a missing fclose() that could explain why your pdf is blank.
> Does this updated test case still fail for you, or does simply adding an
> fclose() to the original test code fix the pdf output?
>
>
>   
Comment 3 Charles Doutriaux 2008-02-12 09:29:37 UTC
Created attachment 14288 [details]
my none readable pdf file
Comment 4 Chris Wilson 2008-02-12 11:27:32 UTC
Well that pdf has NaN for surface->height, which suggests that it's the #include <cairo-ps.h> rather than #include <cairo-pdf.h> in your test code. Could you make that correction and retest - thanks.
Comment 5 Behdad Esfahbod 2008-02-12 11:39:33 UTC
Cairo doesn't use any pdf library btw.
Comment 6 Charles Doutriaux 2008-02-12 13:28:25 UTC
that was it (replace cairo-ps.h with cairo-pdf.h)... VERY embarassing... Sorry I wasted your time for a simple copy/paste error...

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.