I just installed cairo-1.4.0 today, and found that my code that outputs PDF files no longer works. The generated PDF files make every reader I've tried crash. When you look at the files, you can see why. I'm creating a PDF file of size 200x200 points, with a green background and some lines and arcs. With the cairo-1.2.6 backend, the BBox header of the PDF file correctly specifies the size. << /Length 3 0 R /Filter /FlateDecode /Type /XObject /Subtype /Form /BBox [ 0 0 200 200 ] >> With cairo-1.4.0, the header looks as follows: << /Length 3 0 R /Filter /FlateDecode /Type /XObject /Subtype /Form /BBox [ 0 0 0 820455767354305755076758094100026457645073301504 ] >> ... which is obviously invalid.
Created attachment 9011 [details] The correct PDF file. This file was generated by cairo-1.2.6.
Created attachment 9012 [details] Corrupt PDF file. This file was created by cairo-1.4.0.
Created attachment 9013 [details] Program to generate the PDF. Compile with: gcc -o test test.c -lcairo Run with: ./test Outputs test.pdf to the current directory.
Ok, it turns out it's necessary to explicitly cast the pointer to the surface created by cairo_pdf_surface_create to a cairo_surface_t*. This should not be necessary, since the return type of said function is cairo_surface_t*, but it appears to make a difference. Anyone care to explain? :-S - Simon
Because you are on a x86_64 system, with sizeof(int)!=sizeof(void*), and you are not including cairo-pdf.h, so cairo_pdf_surface_create() is not prototyped and assumed to return an int. So you get the following warning: test.c: In function ‘main’: test.c:6: warning: initialization makes pointer from integer without a cast
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.