xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Renderer Performance
Date Tue, 31 Mar 2009 10:03:08 GMT
Uhm, I think you have sent this to the wrong mailing list. FOP support
is at fop-users@xmlgraphics.apache.org. Please drop batik-users@ from
the CC when you reply.

The change that happened from 0.94 to 0.95 was the introduction of a new
image loading framework. But that has improved performance in most cases
rather than the opposite. Specifically for PNG, there was a change:
before, our internal PNG codec was used while now we use the PNG codec
from ImageIO. That this should have such an effect surprises me as I
would expect that to actually be faster. Maybe we have to provide an
option to still use the internal PNG codec. What JVM are you running
this on?

As for improving performance in general, I'm not sure what could be done.
The PNG needs to be decompressed, built up in memory and then
recompressed for PDF output. I've once experimented with 1:1 embedding
of PDFs in PDF but was unable to get this working. The only thing you
can do is try other image formats if possible. For example, if you have
black/white images, you may want to switch to TIFFs with CCITT
compression or, for color images, to JPEG images which can both be
embedded lightning-fast in PDF without decompression and recompression.

On 30.03.2009 19:47:39 Kevin Whittington wrote:
> 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:
> 
>         try {
>             // 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);
> 
>         } catch (FOPException e) {
>                 ...
>         } catch (TransformerException e) {
>                 ...
>         }
> 
> 
> 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>
> 
> Kevin Whittington
> Store Systems Senior Programmer/Analyst
> Catalina Marketing Corporation
> 
> 




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message