Frank,
[Big SNIP]
protected Result obtainResult(XMLServletRequestStatus status,
OutputStream out)
throws IOException
{
if(!status.isFOStyle())
{
return new StreamResult(out);
}
else
{
Driver driver = new Driver();
String version = org.apache.fop.apps.Version.getVersion();
// as of version 0.20.1
//driver.setRenderer(org.apache.fop.render.pdf.PDFRenderer,version);
org.apache.fop.render.Renderer rend = new
org.apache.fop.render.pdf.PDFRenderer();
log.msg(Renderer = +rend);
driver.setRenderer(rend);
driver.addElementMapping(org.apache.fop.fo.StandardElementMapping);
driver.addElementMapping(org.apache.fop.svg.SVGElementMapping);
// as of version 0.20.1
//
driver.addPropertyList(org.apache.fop.fo.StandardPropertyListMapping);
//
driver.addPropertyList(org.apache.fop.svg.SVGPropertyListMapping);
driver.setOutputStream(out);
status.setDriver(driver);
return new SAXResult(driver.getContentHandler());
}
}
This compiles, so at least it uses only known API's, but plugin it into
the surrounding environment, I end up with this:
java.lang.NullPointerException
at
org.apache.fop.fo.FOTreeBuilder.startDocument(FOTreeBuilder.java:167)
[SNIP]
Which looks like the streamRenderer member in FOTreeBuilder has not been
initialized.
Before I start sifting thru the whole code, any quick clue from a guru?
You might also note that I actually don't think I need SVG, put I
didn't get
the
older fops to works without it.
Thank you very much,
Frank
If you are using the latest CVS it should work...
However you might have to call driver.setLogger()
to give FOP a LogKit Logger...
In my program I have something like this...
Driver driver;
ByteArrayOutputStream out = new ByteArrayOutputStream();
driver = new Driver();
// FOP uses Avalon LogKit for Logging, so we need to set it up.
org.apache.log.Hierarchy hierarchy =
org.apache.log.Hierarchy.getDefaultHierarchy();
org.apache.log.format.PatternFormatter formatter = new
org.apache.log.format.PatternFormatter([%{priority}]:
%{message}\n%{throwable});
org.apache.log.LogTarget target = new
org.apache.log.output.io.StreamTarget(System.out, formatter);
hierarchy.setDefaultLogTarget(target);
org.apache.log.Logger log = hierarchy.getLoggerFor(fop);
log.setPriority(org.apache.log.Priority.ERROR);
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);
ContentHandler cnth = driver.getContentHandler();
// send SAX events on cnth.
and it works with the yesterday's CVS...
Keiron, Could you take a look at the things you did for the logger
in driver, it look wierd to me as the _treeBuilder 's logger
is only set if a call to setLogger is done, otherwise I get a
NullPointerException
If you want I can take a look... just say so.
--
Dr. Frank Sven Nestel
Principal Software Engineer
COI GmbHErlanger Straße 62, D-91074 Herzogenaurach
Phone +49 (0) 9132 82 4611
http://www.coi.de, mailto:[EMAIL PROTECTED]
COI - Solutions for Documents
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]