I've seen the messages from
november about it, and I tryied to make something like it, but I'va got
two problems...
This is my adaptation to the
solution from Yuri Shkuro
// -------
// 1. Get a Source for XML document // ------- XSLTInputHandler inputHandler = new XSLTInputHandler(fileXML, fileXSL); XMLReader parser = parser = inputHandler.getParser();
// -------
// 3. Create FOP driver and set rendering mode and output stream // ------- objPfResponse.setContentType("application/pdf"); Driver driver = new Driver(inputHandler.getInputSource(), objPfResponse.getOutputStream()); driver.setRenderer(driver.RENDER_PDF); driver.setXMLReader(parser); driver.render(parser, inputHandler.getInputSource()); driver.run(); My first problem is: I can't see
the pdf report, but if I try to save it, the file is correct and I can see
it. Anyway, the name is set is a *.html, not a *.pdf (though it is saving as an
Adobe Application File...).
And the second one is that I see
an FOPException like this:
using SAX parser
org.apache.xerces.parsers.SAXParser
building formatting object tree setting up fonts [1] Parsing of document complete, stopping renderer Initial heap size: 97331Kb Current heap size: 97265Kb Total memory used: -66Kb Memory use is indicative; no GC was performed These figures should not be used comparatively Total time used: 359ms Pages rendererd: 1 Avg render time: 359ms/page org.apache.fop.apps.FOPException: InputSource is not set. at org.apache.fop.apps.Driver.run(Driver.java:496) But everything is ok, because the file is
well-formed adn I can see it (after saving it, of course).
Thaks a lot
Raśl Carazo
|