Looks like no one replied to your question. Sorry for the delay...
There is an example in the code that shows how to do what you ask: embedding.ExampleXML2PDF under examples/embedding/java.
On 4/8/13 5:15 PM, pepgrifell wrote:
Hi, I have update fop.jar from version 0.95 to 1.1. I have changed as well related libraries (avalon-framework-4.2.0.jar, batik-all-1.7.jar were already in 0.95 and I have only changed xmlgraphics-commons*.jar (from 1.3.1 to 1.5). In 0.95 I could generate a PDF from and XSL and XML but now I get this error: / ... 2013-04-08 15:22:04,148 DEBUG [org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline] Image loading using org.apache.fop.image.loader.batik.ImageLoaderSVG@ca1198 took 0 ms. 2013-04-08 15:22:04,148 DEBUG [org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline] Caching image: org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM: null (image/svg+xml) ... java.lang.AbstractMethodError: org.apache.batik.dom.AbstractDocument.getDocumentURI()Ljava/lang/String; at org.apache.fop.image.loader.batik.BatikUtil.cloneSVGDocument(BatikUtil.java:58) at org.apache.fop.render.pdf.PDFImageHandlerSVG.handleImage(PDFImageHandlerSVG.java:95) at org.apache.fop.render.intermediate.AbstractIFPainter.drawImage(AbstractIFPainter.java:228) at org.apache.fop.render.intermediate.AbstractIFPainter.drawImage(AbstractIFPainter.java:184) at org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingImageHandler(AbstractIFPainter.java:149) at org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingDocument(AbstractIFPainter.java:298) at org.apache.fop.render.pdf.PDFPainter.drawImage(PDFPainter.java:203) at org.apache.fop.render.intermediate.IFRenderer.renderForeignObject(IFRenderer.java:1290) at org.apache.fop.render.AbstractRenderer.renderInlineViewport(AbstractRenderer.java:820) at org.apache.fop.render.AbstractPathOrientedRenderer.renderInlineViewport(AbstractPathOrientedRenderer.java:785) at org.apache.fop.render.intermediate.IFRenderer.renderInlineViewport(IFRenderer.java:866) at org.apache.fop.render.AbstractRenderer.renderInlineArea(AbstractRenderer.java:678) at org.apache.fop.render.intermediate.IFRenderer.renderInlineArea(IFRenderer.java:913) at org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:643) at org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:561) at org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:598) at org.apache.fop.render.intermediate.IFRenderer.renderBlock(IFRenderer.java:980) at org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:546) at org.apache.fop.render.AbstractPathOrientedRenderer.renderReferenceArea(AbstractPathOrientedRenderer.java:710) at org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:585) at org.apache.fop.render.intermediate.IFRenderer.renderBlock(IFRenderer.java:980) at org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:546) at org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:598) at org.apache.fop.render.intermediate.IFRenderer.renderBlock(IFRenderer.java:980) at org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:546) at org.apache.fop.render.AbstractRenderer.renderFlow(AbstractRenderer.java:451) at org.apache.fop.render.AbstractPathOrientedRenderer.renderFlow(AbstractPathOrientedRenderer.java:738) at org.apache.fop.render.AbstractRenderer.renderMainReference(AbstractRenderer.java:428) at org.apache.fop.render.AbstractRenderer.renderBodyRegion(AbstractRenderer.java:352) at org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRenderer.java:299) at org.apache.fop.render.intermediate.IFRenderer.renderRegionViewport(IFRenderer.java:748) at org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.java:273) at org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:238) at org.apache.fop.render.intermediate.IFRenderer.renderPage(IFRenderer.java:597) at org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:123) at org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(AbstractPageSequenceLayoutManager.java:312) at org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:191) at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:115) at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267) at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:128) at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:347) at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:181) at org.apache.xml.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:261) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1399) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2281) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262) / This is how I do the transformation: / FopFactory fopFactory = FopFactory.newInstance(); fopFactory.setStrictValidation(false); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, baos); StreamSource ss = new StreamSource(getXSLFileURL()); TransformerFactory factory = TransformerFactory.newInstance(); ErrorListener errorListener = new org.apache.xml.utils.DefaultErrorHandler(true); factory.setErrorListener(errorListener); Transformer transformer = factory.newTransformer(ss); transformer.setParameter("versionParam", "2.0"); Source src = new StreamSource(getXMLReader(xml)); / Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); / Do you know how I could solve it ? Thanks in advance ! -- View this message in context: http://apache-fop.1065347.n5.nabble.com/error-with-FOP1-1-java-lang-AbstractMethodError-org-apache-batik-dom-AbstractDocument-getDocumentURI-tp38266.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- 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