Tuesday, March 16, 2010

PDF Output with Inkscape 0.46 + Cairo 1.2.4 (RHEL)

I've been having problem producing PDF poster using Inkscape and Cairo that ships with RHEL 5/Centos 5. The default "PDF via Cairo" produces some of the drawings off their designated position when viewed on Mac OS X using Preview. The only option I found working is to save as "Postscript via Cairo" which correctly embeds the font and produces an output exactly as shown, but the bounding box information is lost when I do ps2pdf.

To fix the bounding box, I opened the PostScript output, and it shows the bounding box in the first few lines:

%!PS-Adobe-3.0
%%Creator: cairo (http://cairographics.org)
%%CreationDate: Tue Mar 16 17:36:36 2010
%%Pages: 1
%%BoundingBox: 0 0 2880 2160
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog
...

Then, when doing ps2pdf, I have to manually specify the device width and height like this:

ps2pdf14 -dDEVICEWIDTHPOINTS=2880 -dDEVICEHEIGHTPOINTS=2160 output.ps

This produces output.pdf with the correct paper size. By the way, the points are in PostScript device unit, which is 1/72 of an inch. The poster is 40" by 30".

No comments: