Chris Bowditch wrote:
Flemming Jønsson wrote:

Hi,
I'm trying to make FOP print some reports in Danish with special characters.


When I use the writePDF method to generate a PDF file on the harddrive, the layout is just as I want it and all words are on the same line. This is what I have been using while developing (so I did not block the printer at the office all the time). But I am not interested in getting a PDF file - I need to be able to print to the printer directly, so I switched from calling writePDF to calling print instead. This unfortunately causes problems with special characters :-/

If I use print the words containing the special characters are printed approximately 1mm below the line all other words are printed on, this is not acceptable behavior to us, so I need to find a fix for it.

When using FOP's Print option, FOP uses Java AWT to render the document. When a PDF is rendered FOP uses its own classes when working with Font metrics and laying out the Text. The AWT/Print output is very JDK dependent and there are more differences to the PDF output than just the special characters you have observed. The best approach when you need to print the output is to render to Postscript which uses similar code to the PDF Renderer. Then postscript can then be directed to the Printer using LPR command or similar.


Chris

Nice explanation, Chris. The suggestion to output to -ps (PostScript) is a good one, and (BTW) one that works well on a 'headless' system ;-).


MORE BACKGROUND INFO
====================
To continue a bit further, in my experience, I've noticed significant font kerning problems using the AWT renderer (-awt or -print) for Sun JRE pre 1.4.0_b09 (I think). IBM's JRE 1.3+ appears not to have these problems. In addition, as you've noticed, there appears to be ~10-20% difference in line-height between AWT and PDF. My solution is to have two .fo files (xml_default.fo & xml_default_pdf.fo).


The difference is that xml_default_pdf.fo sets up smaller region-before & region-after extent & margins, and then use xsl:include to 'include' the xml_default.fo template. That way, I reap the benefits of only needing to make changes to one template.

Hope this info is useful!

Web Maestro Clay

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to