Re: Problem with API change in fop 0.20.1

2001-08-22 Thread Keiron Liddle


http://xml.apache.org/fop/embedding.html

On Wed, 22 Aug 2001 09:35:17 Nestel, Frank wrote:
 Hello,
 
 we've experimenting with fop as an PDF renderer and would like to
 upgrde to fop0.20. As this is only a part of a larger framework,
 we used to use the TraX Result Wrappers to pass along our input to
 fop. Somehow I do not understand the latest FOP-API changes:
 
 Before I start sifting thru the whole code, any quick clue from a guru?

is that a good enough guru?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Problem with API change in fop 0.20.1

2001-08-22 Thread Michel Lehon

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]




Re: Problem with API change in fop 0.20.1

2001-08-22 Thread Keiron Liddle

On Wed, 22 Aug 2001 10:20:28 Michel Lehon wrote:
 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.

Michel,

Yes, that is a bit of a problem.
I'll set the logger in the getContentHandler() as with the stream renderer.

It is a bit of a problem that the tree build is and can be used before the
logger is set. The constructor uses the tree builder. It is (sort of) okay
since those methods do not use the logger.
The only way to set it before anything is called on the treebuilder would
be to pass it into the constructor and I don't want to do that.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]