targetrenderer set to MIME_PNG fails in fop >=1.0 but succeeds in 0.95
Hello dear apocalypse survivors, I'm using FOP for a couple of years now and thought it was time to upgrade to version 1.1. Problem is that the rendering to PNG stopped functioning. It all still works with version 0.95. PDF generation is still fine. The difference between PNG and PDF generation is the mime type of fop generated with the factory. Strange thing is that the call to 'userAgent.getRendererOverride()' returns 'null' in version 1.1 and returned the expected PNGRenderer in version 0.95. Is this a bug or is something changed between versions in relation to PNG rendering? >From the debug info I see that the renderer does create a page. It seems like the link between the rendererImpl and the mime-type is not found. But where can I force that? See code fragments below. Thank you very much for any help., Milo van der Zee some relevant code: --- FopFactory fopFactory = FopFactory.newInstance(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setTargetResolution(document.getPreviewDPI()); ByteArrayOutputStream out = new ByteArrayOutputStream(); Fop fop = fopFactory.newFop(MimeConstants.MIME_PNG, foUserAgent, out); TransformerFactory factory = TransformerFactory.newInstance(); Source xslfo = DocumentGenerator.generateXslFo(document); Transformer transformer = factory.newTransformer(xslfo); SAXBuilder saxBuilder = new SAXBuilder(); saxBuilder.setErrorHandler(new SaxParserErrorListener()); org.jdom.Document dataDocument = saxBuilder.build(new StringReader(dataString)); DOMSource src = new DOMSource((new DOMOutputter()).output(dataDocument)); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); FOUserAgent userAgent = fop.getUserAgent(); PNGRenderer renderer = (PNGRenderer)userAgent.getRendererOverride(); --- --- I added this to my pom.xml: --- org.apache.xmlgraphics fop ${fop-version} org.apache.avalon.framework avalon-framework-api org.apache.avalon.framework avalon-framework-impl avalon-framework avalon-framework-api 4.2.0 avalon-framework avalon-framework-impl 4.2.0 --- --- Some debug info: --- DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.ps.extensions.PSExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.txt.TXTRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.PNGRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.TIFFRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.xml.XMLRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.awt.AWTRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.print.PrintRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for FOEventHandler: org.apache.fop.render.rtf.RTFFOEventHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pdf.PDFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pcl.PCLDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.TIFFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.PNGDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.ps.PSDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.afp.AFPDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apach
targetrenderer set to MIME_PNG fails in fop >=1.0 but succeeds in 0.95
Dear FOP users, I'm using FOP for a couple of years now and thought it was time to upgrade to version 1.1. Problem is that the rendering to PNG stopped functioning. It all still works with version 0.95. PDF generation is still fine. The difference between PNG and PDF generation is the mime type of fop generated with the factory. Strange thing is that the call to 'userAgent.getRendererOverride()' returns 'null' in version 1.1 and returned the expected PNGRenderer in version 0.95. Is this a bug or is something changed between versions in relation to PNG rendering? >From the debug info I see that the renderer does create a page. It seems like the link between the rendererImpl and the mime-type is not found. But where can I force that? See code fragments below. Thank you very much for any help., Milo van der Zee some relevant code: --- FopFactory fopFactory = FopFactory.newInstance(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setTargetResolution(document.getPreviewDPI()); ByteArrayOutputStream out = new ByteArrayOutputStream(); Fop fop = fopFactory.newFop(MimeConstants.MIME_PNG, foUserAgent, out); TransformerFactory factory = TransformerFactory.newInstance(); Source xslfo = DocumentGenerator.generateXslFo(document); Transformer transformer = factory.newTransformer(xslfo); SAXBuilder saxBuilder = new SAXBuilder(); saxBuilder.setErrorHandler(new SaxParserErrorListener()); org.jdom.Document dataDocument = saxBuilder.build(new StringReader(dataString)); DOMSource src = new DOMSource((new DOMOutputter()).output(dataDocument)); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); FOUserAgent userAgent = fop.getUserAgent(); PNGRenderer renderer = (PNGRenderer)userAgent.getRendererOverride(); --- --- I added this to my pom.xml: --- org.apache.xmlgraphics fop ${fop-version} org.apache.avalon.framework avalon-framework-api org.apache.avalon.framework avalon-framework-impl avalon-framework avalon-framework-api 4.2.0 avalon-framework avalon-framework-impl 4.2.0 --- --- Some debug info: --- DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.ps.extensions.PSExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.txt.TXTRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.PNGRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.TIFFRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.xml.XMLRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.awt.AWTRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.print.PrintRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for FOEventHandler: org.apache.fop.render.rtf.RTFFOEventHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pdf.PDFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pcl.PCLDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.TIFFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.PNGDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.ps.PSDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.afp.AFPDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.intermediate.IFSerializerMaker DEBUG org.apache.fop.render.XMLHandlerRegistry - Dynamically adding XMLHandler: org.apache.fop.render.pdf.PDFSVGHandler DEBUG org.apache.fop.render.XMLHandlerRegistry - Dynamically adding XMLHandler: org.apache.fop.render.ps.PSSVGHandler
Re: targetrenderer set to MIME_PNG fails in fop >=1.0 but succeeds in 0.95
Can you start with the embedding.ExampleFO2PDF.java example (in examples/embedding/java), change the mime type to MIME_PNG (and rename all the PDFs to PNGs) and confirm that the new example does generate a PNG file? I just tested that with trunk and it worked. On 12/27/12 3:02 PM, Milo van der Zee wrote: Dear FOP users, I'm using FOP for a couple of years now and thought it was time to upgrade to version 1.1. Problem is that the rendering to PNG stopped functioning. It all still works with version 0.95. PDF generation is still fine. The difference between PNG and PDF generation is the mime type of fop generated with the factory. Strange thing is that the call to '*userAgent.getRendererOverride()*' returns 'null' in version 1.1 and returned the expected PNGRenderer in version 0.95. Is this a bug or is something changed between versions in relation to PNG rendering? From the debug info I see that the renderer does create a page. It seems like the link between the rendererImpl and the mime-type is not found. But where can I force that? See code fragments below. Thank you very much for any help., Milo van der Zee some relevant code: --- FopFactory fopFactory = FopFactory.newInstance(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setTargetResolution(document.getPreviewDPI()); ByteArrayOutputStream out = new ByteArrayOutputStream(); Fop fop = fopFactory.newFop(*MimeConstants.MIME_PNG*, foUserAgent, out); TransformerFactory factory = TransformerFactory.newInstance(); Source xslfo = DocumentGenerator.generateXslFo(document); Transformer transformer = factory.newTransformer(xslfo); SAXBuilder saxBuilder = new SAXBuilder(); saxBuilder.setErrorHandler(new SaxParserErrorListener()); org.jdom.Document dataDocument = saxBuilder.build(new StringReader(dataString)); DOMSource src = new DOMSource((new DOMOutputter()).output(dataDocument)); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); FOUserAgent userAgent = fop.getUserAgent(); *PNGRenderer renderer = (PNGRenderer)userAgent.getRendererOverride();* --- --- I added this to my pom.xml: --- org.apache.xmlgraphics fop ${fop-version} org.apache.avalon.framework avalon-framework-api org.apache.avalon.framework avalon-framework-impl avalon-framework avalon-framework-api 4.2.0 avalon-framework avalon-framework-impl 4.2.0 --- --- Some debug info: --- DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.render.ps.extensions.PSExtensionHandlerFactory DEBUG org.apache.fop.util.ContentHandlerFactoryRegistry - Dynamically adding ContentHandlerFactory: org.apache.fop.fo.extensions.xmp.XMPContentHandlerFactory DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.txt.TXTRendererMaker DEBUG org.apache.fop.render.RendererFactory - *Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.PNGRendererMaker* DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.bitmap.TIFFRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.xml.XMLRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.awt.AWTRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for Renderer: org.apache.fop.render.print.PrintRendererMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for FOEventHandler: org.apache.fop.render.rtf.RTFFOEventHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pdf.PDFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.pcl.PCLDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.TIFFDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.bitmap.PNGDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.ps.PSDocumentHandlerMaker DEBUG org.apache.fop.render.RendererFactory - Dynamically adding maker for IFDocumentHandler: org.apache.fop.render.afp.AFPDocumentHandlerMaker DEBUG org.apache.fop.render.Ren