More of an FYI for others rather than an issue, but if you include an SVG in your fo FOP will try to render it using Apache Batik which in turn uses AWT which is not implemented by IKVM. The error I got wasn't super helpful but if you see anything in the stack trace related to AWT, basically, it's not going to work:
Here's the exception I'm seeing in my particular scenario:
System.TypeInitializationException: The type initializer for 'org.apache.batik.bridge.DefaultFontFamilyResolver' threw an exception.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at IKVM.Java.Externs.java.lang.Class.forName0(String name, Boolean initialize, ClassLoader loader, Class caller)
at java.lang.Class.forName0(String name, Boolean initialize, ClassLoader loader, Class caller)
at java.lang.Class.forName(String className, CallerID)
at java.awt.GraphicsEnvironment.createGE()
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
at org.apache.batik.bridge.DefaultFontFamilyResolver..cctor()
--- End of inner exception stack trace ---
at org.apache.fop.image.loader.batik.PreloaderSVG.Loader.createImageInfo(String uri, ImageContext context, SVGDocument doc)
at org.apache.fop.image.loader.batik.PreloaderSVG.Loader.getImage(String uri, Source src, ImageContext context)
at org.apache.fop.image.loader.batik.PreloaderSVG.Loader.access$200(Loader x0, String x1, Source x2, ImageContext x3)
at org.apache.fop.image.loader.batik.PreloaderSVG.preloadImage(String uri, Source src, ImageContext context)
at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(String uri, Source src)
at org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingDocument(Document doc, Rectangle rect)
at org.apache.fop.render.pdf.PDFPainter.drawImage(Document doc, Rectangle rect)
at org.apache.fop.render.intermediate.IFRenderer.renderForeignObject(ForeignObject fo, Rectangle2D pos)
at org.apache.fop.render.AbstractRenderer.renderInlineViewport(InlineViewport viewport)
at org.apache.fop.render.AbstractPathOrientedRenderer.renderInlineViewport(InlineViewport viewport)
at org.apache.fop.render.intermediate.IFRenderer.renderInlineViewport(InlineViewport viewport)
at org.apache.fop.render.AbstractRenderer.renderInlineArea(InlineArea inlineArea)
at org.apache.fop.render.intermediate.IFRenderer.renderInlineArea(InlineArea inlineArea)
at org.apache.fop.render.AbstractRenderer.renderLineArea(LineArea line)
at org.apache.fop.render.AbstractRenderer.renderBlocks(Block parent, List blocks)
at org.apache.fop.render.AbstractRenderer.renderBlock(Block block)
at org.apache.fop.render.intermediate.IFRenderer.renderBlock(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlocks(Block parent, List blocks)
at org.apache.fop.render.AbstractPathOrientedRenderer.renderReferenceArea(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlock(Block block)
at org.apache.fop.render.intermediate.IFRenderer.renderBlock(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlocks(Block parent, List blocks)
at org.apache.fop.render.intermediate.IFRenderer.renderBlockViewport(BlockViewport bv, List children)
at org.apache.fop.render.AbstractRenderer.renderBlock(Block block)
at org.apache.fop.render.intermediate.IFRenderer.renderBlock(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlocks(Block parent, List blocks)
at org.apache.fop.render.AbstractPathOrientedRenderer.renderReferenceArea(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlock(Block block)
at org.apache.fop.render.intermediate.IFRenderer.renderBlock(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlocks(Block parent, List blocks)
at org.apache.fop.render.intermediate.IFRenderer.renderBlockViewport(BlockViewport bv, List children)
at org.apache.fop.render.AbstractRenderer.renderBlock(Block block)
at org.apache.fop.render.intermediate.IFRenderer.renderBlock(Block block)
at org.apache.fop.render.AbstractRenderer.renderBlocks(Block parent, List blocks)
at org.apache.fop.render.AbstractRenderer.renderFlow(NormalFlow flow)
at org.apache.fop.render.AbstractPathOrientedRenderer.renderFlow(NormalFlow flow)
at org.apache.fop.render.AbstractRenderer.renderMainReference(MainReference mainReference)
at org.apache.fop.render.AbstractRenderer.renderBodyRegion(BodyRegion region)
at org.apache.fop.render.AbstractRenderer.renderRegionViewport(RegionViewport port)
at org.apache.fop.render.intermediate.IFRenderer.renderRegionViewport(RegionViewport viewport)
at org.apache.fop.render.AbstractRenderer.renderPageAreas(Page page)
at org.apache.fop.render.AbstractRenderer.renderPage(PageViewport page)
at org.apache.fop.render.intermediate.IFRenderer.renderPage(PageViewport page)
at org.apache.fop.area.RenderPagesModel.addPage(PageViewport page)
at org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage()
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage()
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout()
at org.apache.fop.area.AreaTreeHandler.endPageSequence(PageSequence pageSequence)
at org.apache.fop.fo.pagination.PageSequence.endOfNode()
at org.apache.fop.fo.FOTreeBuilder.MainFOHandler.endElement(String uri, String localName, String rawName)
at org.apache.fop.fo.FOTreeBuilder.3.run()
at org.apache.fop.fo.FOTreeBuilder.3.run()
at java.security.AccessController.doPrivileged(Object action, AccessControlContext context, CallerID callerID)
at java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID)
at org.apache.fop.fo.FOTreeBuilder.endElement(String uri, String localName, String rawName)
at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(String namespaceURI, String localName, String qName)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(QName element, Augmentations augs)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement()
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.FragmentContentDriver.next()
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next()
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next()
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Boolean complete)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Boolean complete)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XMLInputSource source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLInputSource inputSource)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(InputSource inputSource)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Source source, SerializationHandler handler)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Source source, SerializationHandler handler, String encoding)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Source source, Result result)
More of an FYI for others rather than an issue, but if you include an SVG in your
fo
FOP will try to render it using Apache Batik which in turn uses AWT which is not implemented by IKVM. The error I got wasn't super helpful but if you see anything in the stack trace related to AWT, basically, it's not going to work:Here's the exception I'm seeing in my particular scenario: