xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Whittington <Kevin.Whitting...@catalinamarketing.com>
Subject Renderer Performance
Date Tue, 31 Mar 2009 13:26:55 GMT
Hello all,

I am currently rendering a legal size document to PDF with fop 0.94 that contains two panels
of graphics. Each panel contains a single 300 dpi PNG file.  Additional text is rendered on
the page but is very minimal.  The rendering is taking upwards of 4 seconds to complete on
my development box (1g ram, 2.5ghz processor).  I've tried all optimizations I could find
including the use of BufferedOutputStreams and usage of url's for external graphics to try
to improve the time (hopefully to 1 to 1.5 seconds).  Nothing I've tried is making much of
an improvement in the render time.  Does anyone have any experience with increasing render
performance from fop?  I upgraded to fop 0.95 and actually saw performance drop off dramatically
so I'm currently using 0.94.  Any help with this issue would be greatly appreciated!

My rendering source code looks like the following which is the basic strategy proposed by
apache's website:

       // Setup input and output for XSLT transformation
       Source xslSrc = new StreamSource(xslFile);

       // Create transformer.
       Transformer transformer = createTransformer(xslSrc);

       // Resulting SAX events (the generated FO) must be piped through to FOP
       Result res = new SAXResult(fop.getDefaultHandler());

       // Load specification into a source.
       Source src = new DOMSource(document);

       // Perform the transform.
       transformer.transform(src, res);


My FO document is very simple.  Below is an abridged version:

<?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:template match="/">

        <fo:root>

            <!-- Define the page layout. -->
            <fo:layout-master-set>
                    <fo:simple-page-master master-name="pamphlet" page-height="8.5in"
                    page-width="14.5in" margin-top="0in" margin-bottom="0in"
                    margin-left=".1875in" margin-right="0in">
                    <fo:region-body margin-top=".1875in"/>
                </fo:simple-page-master>
            </fo:layout-master-set>

            <fo:page-sequence master-reference="pamphlet">
                <fo:flow flow-name="xsl-region-body">
                    <xsl:apply-templates select="specification/panelOneFile"/>
                    <xsl:apply-templates select="specification/panelTwoFile"/>
                </fo:flow>
            </fo:page-sequence>

        </fo:root>

    </xsl:template>

    <!-- Panel 1 -->
    <xsl:template match="specification/panelOneFile">
        <fo:block-container height="8.2in" width="4.25in" top="0in" left="4.5in" padding="0mm"
position="absolute">
            <fo:block>
                <fo:external-graphic top="1cm" src="{//panelOneFile}"/>
            </fo:block>
        </fo:block-container>

    <!-- Panel 2 -->
    <xsl:template match="specification/panelTwoFile">
        <fo:block-container height="8.2in" width="4.25in" top="0in" left="9.1in" padding="0mm"
position="absolute">
            <fo:block>
                <fo:external-graphic top="1cm" src="{//panelTwoFile}"/>
            </fo:block>
        </fo:block-container>
    </xsl:template>

</xsl:stylesheet>

My xsl file is simple as well:

<?xml version="1.0" encoding="UTF-8"?>
<specification>
    <panelOneFile>url('c:/example/example1.png')</panelOneFile>
    <panelTwoFile>url('c:/example/example2.png')</panelTwoFile>
</specification>


Mime
View raw message