RE: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events...
Hi, I noticed that I did not update some of the comments in the Javadoc to reflect the changes I made... If those changes are accepted, I'll be glad to update the Comments and take a look at some of the docs about embedding. Michel. -Original Message- From: Michel Lehon [mailto:[EMAIL PROTECTED]] Sent: Monday, 13 August, 2001 15:24 To: [EMAIL PROTECTED] Subject: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events... Hi, I just upgraded our program to use FOP 0.20.0 We embedded FOP and used the old official method to call it. I mean using somthing like this : Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); ContentHandler cnth = driver.getContentHandler(); sendSAXEvents(cnth); driver.format(); driver.render(); byte[] content = out.toByteArray(); However this not longer works with 0.20.0 for a few reasons: 1°) there is no driver.format() method. 2°) there is no driver.render() method (there are two version with parameters). Still removing those two method calls still does not work as using the ContentHandler returned by driver.getContentHandler generates a NullPointException because the _treeBuilder.setStreamRenderer(streamRenderer) is not called (and the FOTreeBuilder needs it). so I changed a few lines in Driver.java to fix this... I added a method driver.prepareRender() that setups the _treeBuilder I changed both render method to use the new prepareRender so my program now looks like this (and works). Driver driver= new Driver(); driver.setRenderer(Driver.RENDER_PDF); ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); driver.prepareRender(); ContentHandler cnth = driver.getContentHandler(); sendSAXEvents(cnth); byte[] content = out.toByteArray(); What do you think ? Was it a good idea ? anyother idea on how to acheive this ? I though about putting back the render() method (without parameters), but I tough it was weird as it would need to be called before the SAX events are generated. Michel Lehon [EMAIL PROTECTED] SAS Data Warehousing and Web Enablement. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events...
Hi, as far as I understand, there has been a change in the public API because of Mark's patch, so the old method doesn't work anymore. You can see the new code in examples/embedding. It works fine for me. or more info: http://xml.apache.org/fop/embedding.html BTW: the html-docs included in the FOP_0_20 distribution are for FOP 0.18 ??? Peter Peter Jacobs Freelance multimedia programmeur De Budetstraat 8 B-3201 Aarschot [EMAIL PROTECTED] 016/573257 -Original Message- From: Michel Lehon [mailto:[EMAIL PROTECTED]] Sent: maandag 13 augustus 2001 15:24 To: [EMAIL PROTECTED] Subject: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events... Hi, I just upgraded our program to use FOP 0.20.0 We embedded FOP and used the old official method to call it. I mean using somthing like this : Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); ContentHandler cnth = driver.getContentHandler(); sendSAXEvents(cnth); driver.format(); driver.render(); byte[] content = out.toByteArray(); However this not longer works with 0.20.0 for a few reasons: 1°) there is no driver.format() method. 2°) there is no driver.render() method (there are two version with parameters). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events...
Peter, It works fine if you use one of the render methods... which I can't since I'm firing SAX events myself. sadly using the ContentHandler returned by driver.getContentHandler() throws a NullPointerException (as I explained in my previous mails). The Docs you a refering to (and the ones in 0.20.0, I did not check 0.20.1 yet) are outdated (i.e. they still talk about the driver.format() method). Michel. PS: Nice to see other belgians out here :). -Original Message- From: Peter Jacobs [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 14 August, 2001 11:25 To: [EMAIL PROTECTED] Subject: RE: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events... Hi, as far as I understand, there has been a change in the public API because of Mark's patch, so the old method doesn't work anymore. You can see the new code in examples/embedding. It works fine for me. or more info: http://xml.apache.org/fop/embedding.html BTW: the html-docs included in the FOP_0_20 distribution are for FOP 0.18 ??? Peter Peter Jacobs Freelance multimedia programmeur De Budetstraat 8 B-3201 Aarschot [EMAIL PROTECTED] 016/573257 -Original Message- From: Michel Lehon [mailto:[EMAIL PROTECTED]] Sent: maandag 13 augustus 2001 15:24 To: [EMAIL PROTECTED] Subject: Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events... Hi, I just upgraded our program to use FOP 0.20.0 We embedded FOP and used the old official method to call it. I mean using somthing like this : Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); ContentHandler cnth = driver.getContentHandler(); sendSAXEvents(cnth); driver.format(); driver.render(); byte[] content = out.toByteArray(); However this not longer works with 0.20.0 for a few reasons: 1°) there is no driver.format() method. 2°) there is no driver.render() method (there are two version with parameters). - 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 FOP 0.20.0 when using the ContentHandler to feed SAX events...
Peter, It works fine if you use one of the render methods... which I can't since I'm firing SAX events myself. sadly using the ContentHandler returned by driver.getContentHandler() throws a NullPointerException (as I explained in my previous mails). sorry, should read more carefully before posting. I am only using FOP on a basic level... PS: Nice to see other belgians out here :). There seem to be quite a few belgians on this list. Maybe we could set up a local FOP evangelization group :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Problem with FOP 0.20.0 when using the ContentHandler to feed SAX events...
Hi, I just upgraded our program to use FOP 0.20.0 We embedded FOP and used the old official method to call it. I mean using somthing like this : Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); ContentHandler cnth = driver.getContentHandler(); sendSAXEvents(cnth); driver.format(); driver.render(); byte[] content = out.toByteArray(); However this not longer works with 0.20.0 for a few reasons: 1°) there is no driver.format() method. 2°) there is no driver.render() method (there are two version with parameters). Still removing those two method calls still does not work as using the ContentHandler returned by driver.getContentHandler generates a NullPointException because the _treeBuilder.setStreamRenderer(streamRenderer) is not called (and the FOTreeBuilder needs it). so I changed a few lines in Driver.java to fix this... I added a method driver.prepareRender() that setups the _treeBuilder I changed both render method to use the new prepareRender so my program now looks like this (and works). Driver driver= new Driver(); driver.setRenderer(Driver.RENDER_PDF); ByteArrayOutputStream out = new ByteArrayOutputStream(); driver.setOutputStream(out); driver.prepareRender(); ContentHandler cnth = driver.getContentHandler(); sendSAXEvents(cnth); byte[] content = out.toByteArray(); What do you think ? Was it a good idea ? anyother idea on how to acheive this ? I though about putting back the render() method (without parameters), but I tough it was weird as it would need to be called before the SAX events are generated. Michel Lehon [EMAIL PROTECTED] SAS Data Warehousing and Web Enablement. Driver.java - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]