You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Flemming Jønsson <fl...@systematic.dk> on 2004/05/13 10:40:12 UTC
Differences in output from writePDF and print in FOP when content has special characters
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.
I can recreate this behavior on both FOP 0.20.4 and 0.20.5. But is there a patch somewhere that causes writePDF and print to generate identical output in either of these versions?
Or is there anyone in this group that has successfully managed to use print with special characters and gotten all words printed on a straight line? If so, I would really like to see an example to check if I have missed a step somewhere.
Thank you in advance.
Regards,
Flemming
--
Flemming Jønsson
Systems Engineer, M.Sc. C.S.
Systematic Software Engineering A/S
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Differences in output from writePDF and print in FOP when content
has special characters
Posted by Clay Leeds <cl...@medata.com>.
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: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Differences in output from writePDF and print in FOP when content
has special characters
Posted by Chris Bowditch <bo...@hotmail.com>.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org