Andrew,

I too have noticed a difference when I use -print and when I output to a file using -pdf. The primary differences I've found relate to VERTICAL FontMetrics. In other words, in the PDF version, the region-before and region-after sections appear larger than necessary. The percentage difference ranges from 112% larger to 150% larger (it appears to be almost exponential, generally depending on how large the region-before or region-after is). I think it has to do with postscript rendering differences, as I've moticed the same problem when I render to -ps. In addition, if I send it to -print, but specify Acrobat PDFWriter or Acrobat Distiller, I notice the same problem.

What follows is not exactly a "fix" but instead is more of a work-around. My work-around is to have two versions of my FO files: a "print" version and a "pdf" version. Then, since I call FOP using either a script (*.BAT file for Win or a *.sh for Unix), I merely specify a different script depending on the output method. Since I'd rather not have to modify two files when making changes, the "pdf" version is fairly short and instead does an <xsl:include> of the print version. After the xsl:include line, I set the following:

- xsl:attributes
- fo:root
  - fo:layout-master-set
    - fo:simple-page-master
      - fo:region-body
      - fo:region-before
      - fo_region-after
    - fo:page-sequence-master
      - repeatable-page-master-reference
      - single-page-master-reference
  - fo:page-sequence
    - fo:static-content
    - fo:static-content
    - fo:flow

Here's the actual code (I removed a bunch of comments and xsl:if & choose statements to improve readability--if you find I haven't closed a tag that's why--the unmodified version works ;-).

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<xsl:include href="xml_med7_default.fo"/>
<xsl:attribute-set name="attNormal">
<xsl:attribute name="background-color">#ffffff</xsl:attribute>
<xsl:attribute name="color">#000000</xsl:attribute>
<xsl:attribute name="font-family">courier new, courier, monospace</xsl:attribute>
<xsl:attribute name="font-size">8pt</xsl:attribute>
</xsl:attribute-set>
<xsl:variable name="varNormalBGColor">#ffffff</xsl:variable>
<xsl:variable name="varHeadingBGColor">#dddddd</xsl:variable>
<xsl:variable name="varAccentBGColor">#ccffff</xsl:variable>
<xsl:variable name="varWIWCHeading2BGColor">#999999</xsl:variable>
<xsl:variable name="varHeadingFontSize">9pt</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="doc"/>
</xsl:template>
<xsl:template match="doc">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<fo:layout-master-set>
<fo:simple-page-master master-name="repeating" page-height="28cm" page-width="22cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="0cm">
<fo:region-body margin-bottom="2.6cm" margin-top="6.4cm"/>
<fo:region-before extent="6.4cm"/>
<fo:region-after extent="2.6cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="refundletter" page-height="28cm" page-width="22cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
<fo:region-body region-name="refundletter"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="repeating_pm">
<fo:repeatable-page-master-reference master-name="repeating"/>
<fo:single-page-master-reference master-reference="refundletter"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="repeating">
<fo:static-content flow-name="xsl-region-before">
<fo:block padding="0pt" xsl:use-attribute-sets="attNormal">
<xsl:call-template name="tmpHeader"/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block xsl:use-attribute-sets="attNormal">
<xsl:call-template name="tmpFooter"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block xsl:use-attribute-sets="attNormal">
<xsl:call-template name="tmpBody"/>
<fo:block padding="0pt" font-size="1pt">
<fo:marker marker-class-name="table-continued"/>
</fo:block>
</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="refundletter">
<fo:flow flow-name="refundletter">
<fo:block xsl:use-attribute-sets="attNormal">
<xsl:call-template name="tmpRefundLetter"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>


BTW, you may notice that I've placed all of my content for each fo:page-sequence item in a template. I found this makes it easier for me to make modifications to margins, etc. You may also notice my "table-continued" marker at the end of the fo:flow which I use for a "Continued on next page" marker on every page except the last.

I hope you find this useful.
--
Clay Leeds - [EMAIL PROTECTED]
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


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



Reply via email to