Hi Tim, Tim Heuer <heu...@landcareresearch.co.nz> wrote on 02/10/2011 06:17:06 PM:
> The units seem to be wrong or I am doing a mistake. [...] > UserAgent userAgent = new UserAgentAdapter(); Since the correct relationship between 'px' and real world units is dependent on the rendering context the UserAgent has a method that allows you do specify this relationship, this is the default in the UserAgentAdapter we provide. /** * Returns the size of a px CSS unit in millimeters. */ public float getPixelUnitToMillimeter() { return 0.26458333333333333333333333333333f; // 96dpi } > I looked up the SVG specifications and found that pt is 1.25 pixels. > However, this renders wrongly on the PDF. The image becomes too big > and is cut off. When I enter 1.5f instead of 1.25f above, it seems > more correct but still a bit out. So given that we use the above figure 1.333 would be correct. But I suggest you use the above method to work out the relationship between pt and px. > I don’t want to hack together a number that will just happen to look > right, because it is the wrong approach. Is there some kind of > trickiness with the units between SVG and PDF (using iText)? I'll just second Jeremias' suggestion that FOP/Batik already includes a PDF renderer that has code so it generates better output from Batik (as mentioned "simple: SVG text will stay text in the output and Gradients generally do not get rasterized). > Help is much appreciated. I am working on the legends’ rendering in > SVG in the MapFish print module and will submit the source back to > the project, so I think they would appreciate your input too. Hope that helps. Thomas DeWeese | CDG Advanced Development | Eastman Kodak Company | 343 State Street | Rochester, NY 14650-0128 | thomas.dewe...@kodak.com | 585 724-0294 | www.kodak.com