Dear All,
Below is the snippet of code I'm using to do XML -> XSL-FO -> PDF
conversion. The problemmatic statement is transformer.transform(src, res);
which is taking 20-25 secs to execute which is not acceptable to the
business. I'm using FOP - 0.94
// Setup directories
File baseDir = new File(".");
File outDir = new File(baseDir, "out");
outDir.mkdirs();
// Setup input and output files
File xmlfile = new File(baseDir, "xml/xml/projectteam.xml");
File xsltfile = new File(baseDir,
"xml/xslt/projectteam2fo.xsl");
File pdffile = new File(outDir, "ResultXML2PDF.pdf");
// configure fopFactory as desired
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
// configure foUserAgent as desired
// Setup output
OutputStream out = new java.io.FileOutputStream(pdffile);
out = new java.io.BufferedOutputStream(out);
try {
// Construct fop with desired output format
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
foUserAgent, out);
// Setup XSLT
TransformerFactory factory =
TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new
StreamSource(xsltfile));
// Set the value of a in the stylesheet
transformer.setParameter("versionParam", "2.0");
// Setup input for XSLT transformation
Source src = new StreamSource(xmlfile);
// Resulting SAX events (the generated FO) must be piped
through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
} finally {
out.close();
}
Application logs display series of below messages during transformation
(which presumably taking bulk of the time)
2008-03-05 10:04:08,375 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-family, fo:table-cell
2008-03-05 10:04:08,382 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-family, fo:table-row
2008-03-05 10:04:08,387 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-family, fo:table-body
2008-03-05 10:04:08,393 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-family, fo:table
2008-03-05 10:04:08,400 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-family, fo:table-cell
2008-03-05 10:04:08,406 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-family, fo:table-row
2008-03-05 10:04:08,414 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:block
2008-03-05 10:04:08,419 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-cell
2008-03-05 10:04:08,423 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-row
2008-03-05 10:04:08,429 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-body
2008-03-05 10:04:08,436 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:table
2008-03-05 10:04:08,441 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-cell
2008-03-05 10:04:08,449 [StaticCacheThread-4] DEBUG (PropertyMaker.java:
254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-row
Any help in this regard is greatly appreciated
Thanks,
Charanpreet.
--
View this message in context:
http://www.nabble.com/Poor-Performance-of-JAXP-transformer-on-passing-FOP-handler-tp15843663p15843663.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]