无法处理大量数据的PDF转换(XSLFO到PDF)。
使用FOP1.1,xalan-2.7.1,xercesImpl-2.9.0,serializer-2.9.1 jars进行此过程。 Windows操作系统是32位。 为此过程分配的JVM空间为-Xmx1500M。
有没有其他方法来改善以下xsl代码的性能是否有更好的pdf渲染罐可用..请帮忙。
<fo:table-body>
<xsl:for-each select="MSISDN/ITEM/CALLSUM">
<fo:table-row>
<fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="264.33pt" reference-orientation="0">
<fo:block-container reference-orientation="0" >
<fo:block keep-together="auto" ><!-- GENERATE TABLE START-->
<xsl:message>before if</xsl:message>
<xsl:apply-templates match="CALLS[position() mod 2 != 0]"/>
</fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell>
<fo:block-container reference-orientation="0" >
<fo:block keep-together="auto" >
<xsl:apply-templates match="CALLS[position() mod 2 =0]"/>
</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
<xsl:template match="CALLS[position() mod 2 !=0 ]">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="56.05pt"/>
<fo:table-column column-width="18.0pt"/>
<fo:table-column column-width="71.0pt"/>
<fo:table-column column-width="45.52pt"/>
<fo:table-column column-width="48.37pt"/>
<fo:table-column column-width="25.47pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="56.05pt" reference-orientation="0">
<fo:block-container>
<fo:block linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed" padding-bottom="0.0pt" start-indent="1.42pt" end-indent="0.0pt" padding-top="0.0pt" line-height="7.199999999999999pt" line-stacking-strategy="max-height" white-space-collapse="false" hyphenate="true" language="en" text-align="start" keep-together="auto" color="#000000" font-family="Arial" font-size="6.0pt" letter-spacing="normal" word-spacing="normal">
<fo:inline color="#000000" font-family="Arial" font-size="6.0pt">
<xsl:value-of disable-output-escaping="no" select="@OPN"/>
</fo:inline>
</fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="48.37pt" reference-orientation="0">
<fo:block-container>
<fo:block linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" line-height="7.199999999999999pt" line-stacking-strategy="max-height" white-space-collapse="false" hyphenate="true" language="en" text-align="start" keep-together="auto" color="#000000" font-family="Arial" font-size="6.0pt" letter-spacing="normal" word-spacing="normal">
<fo:inline color="#000000" font-family="Arial" font-size="6.0pt">
<xsl:value-of disable-output-escaping="no" select="@CALL_TYPE"/>
</fo:inline>
</fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="57.0pt" reference-orientation="0">
<fo:block-container>
<fo:block linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" line-height="7.199999999999999pt" line-stacking-strategy="max-height" white-space-collapse="false" hyphenate="true" language="en" text-align="center" keep-together="auto" color="#000000" font-family="Arial" font-size="6.0pt" letter-spacing="normal" word-spacing="normal">
<fo:inline color="#000000" font-family="Arial" font-size="6.0pt">
<xsl:value-of disable-output-escaping="no" select="@DT"/>
</fo:inline>
</fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="51.21pt" reference-orientation="0">
<fo:block-container>
<fo:block linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" line-height="7.199999999999999pt" line-stacking-strategy="max-height" white-space-collapse="false" hyphenate="true" language="en" text-align="center" keep-together="auto" color="#000000" font-family="Arial" font-size="6.0pt" letter-spacing="normal" word-spacing="normal">
<fo:inline color="#000000" font-family="Arial" font-size="6.0pt">
<xsl:value-of disable-output-escaping="no" select="@BILLDUR"/>
</fo:inline>
</fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell border-right-style="solid" border-right-width="0.57pt" border-right-color="#000000" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="31.3pt" reference-orientation="0">
<fo:block-container>
<fo:block linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" line-height="7.199999999999999pt" line-stacking-strategy="max-height" white-space-collapse="false" hyphenate="true" language="en" text-align="start" keep-together="auto" color="#000000" font-family="Arial" font-size="6.0pt" letter-spacing="normal" word-spacing="normal">
<fo:inline color="#000000" font-family="Arial" font-size="6.0pt">
<xsl:value-of disable-output-escaping="no" select="@AMT"/>
</fo:inline>
</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
答案 0 :(得分:0)
我无法想象xsl-fo代码优化可以节省足够的内存,问题似乎是数据量。也许另一个渲染器可能会驱使你离开这个。您可以尝试使用alt-soft的Xml2PDF,它是免费的,适用于Windows。见http://www.alt-soft.com/index/products/xml2pdf-workstation/
答案 1 :(得分:0)
答案 2 :(得分:0)
为了提高XSL的性能,请避免使用xsl:for-each并将其替换为apply-templates。
<table-body>
<xsl:apply-templates select="MSISDN/ITEM/CALLSUM"/>
</table-body>
<xsl:template match="CALLSUM">
<!-- The content of the template -->
</xsl:template>