If you're using embedded code you have a Fop fop = fopFactory.newFop( ... statement which accepts an outputstream. If you want to keep your output in memory instead of writing it to disk you can read it from that stream. Use a ByteArrayOutputStream instead of a FileOutputStream.
-----Original Message----- From: Todd Hivnor [mailto:spambox_98...@yahoo.com] Sent: Sunday, October 30, 2011 7:40 PM To: fop-users@xmlgraphics.apache.org; Todd Hivnor Subject: Re: Generating PNG files from FO sources More info: I now realize that the convertFO2PDF from https://xmlgraphics.apache.org/fop/1.0/embedding.html#ExampleFO2PDF can be modified to use MimeConstants.MIME_PNG in place of MimeConstants.MIME_PDF. Very straight-forward! However ... that solution isn't quite what I'm looking for. In some cases I want a BufferedImage not a file. I guess I could save a file and then read in a BufferedImage. But I'm hoping to get the BufferedImage without having to write it out to disk. Also I can't get the page count. With AWTRenderer from FOP 0.20, I could call getNumberOfPages to see if my report fit onto a single page. I've got code which then reduced the font size & tried again if the page count was greater than 1. So, I guess my subject line should really be "Generating BufferedImages from FO sources" ... ----- Original Message ----- From: Todd Hivnor <spambox_98...@yahoo.com> To: "fop-users@xmlgraphics.apache.org" <fop-users@xmlgraphics.apache.org> Cc: Sent: Sunday, October 30, 2011 2:12 PM Subject: Generating PNG files from FO sources I'm _finally_ getting around to upgrading from FOP 0.20 to FOP 1.0! My existing code uses org.apache.fop.apps.Driver. I see that is no longer available, so I'm trying to figure out how to port my code. I figured out PDF generation, but can't figure out how to render a PNG from an FO file. All the examples in documentation talk about PDF, I can't find a PNG example. Is there sample code I haven't found? Or can someone provide a hint as to what classes I should be using and the key method calls? I found PNGRendererMaker so I can get a renderer. But I'm not sure what to do with it. Perhaps call it's renderXml method? In that case, what do I need for the namespace argument? I don't use XSLT, I just generate the FO code directly in Java. Any clues appreciated ... --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org