我正嘗試使用FOP創建帶有圖像內容的PDF文件。我嘗試了許多版本的蠟染庫,但我總是收到下面的堆棧跟蹤。圖像src與此類似:「data:image/jpeg; base64,DATA」(DATA是Base64編碼的圖像內容)。fo:external-graphic issue
的代碼看起來是這樣的:
Document xslDoc = getConverterXsl();
FopFactory fopFactory = null;
fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, pdfOutputStream);
Result res = new SAXResult(fop.getDefaultHandler());
doXslTransform(xslDoc, fopDoc, res);
請幫助我。
此致 羅蘭
java.lang.NoSuchMethodError:org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(Ljava /郎/字符串; Ljava/IO /的InputStream)Lorg/W3C/DOM/SVG/SVGDocument; at org.apache.fop.image.loader.batik.PreloaderSVG $ Loader.getImage(PreloaderSVG.java:127) at org.apache.fop.image.loader.batik.PreloaderSVG $ Loader.access $ 200(PreloaderSVG.java :106) at org.apache.fop.image.loader.batik.PreloaderSVG.preloadImage(PreloaderSVG.java:74) at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:175) 在org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:128) 在org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:122) 在org.apache .fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81) at org.apache.fop.fo.FObj.processNode(FObj.java:124) at org.apache.fop.fo.FOTreeBuilder $ MainFOHandl er.startElement(FOTreeBuilder.java:280) at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(未知源) at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(Unknown Source) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown Source) 在Converter.template $ dot $ 1() Converter.template $ dot $ 0() 在Converter.applyTemplates() 在Converter.applyTemplates() 在Converter.tran sform() at ...