gpt4 book ai didi

java - Apache FOP 2.0 - 为什么没有找到 SVG 的 ImagePreloader?

转载 作者:太空宇宙 更新时间:2023-11-04 13:39:09 25 4
gpt4 key购买 nike

我在 jsf 应用程序(使用 JBoss 7)中使用 Apache FOP 2.0 来创建 pdf 文件。但如果我想包含 svg,则会出现以下错误:

Image not available. URI: image/svg.svg. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for image/svg.svg (No context info available): org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for image/svg.svg

此错误仅发生在 svg 文件中。其他图像类型(jpg 或 png)可以正常工作。所以我做了一些研究并找到了一些方法:

<小时/>

Apache FOP in a Java Applet - No ImagePreloader found for data

我更改了我的 pom,以便在 fop 之前加载 xmlgraphics-commons,但它不起作用。我在版本 2.0.1 中使用 xmlgraphics-commons 在版本 1.8 中使用 batik ,在版本 4.3.1 中使用 avalon-framework (api 和 impl)。

<小时/>

http://apache-fop.1065347.n5.nabble.com/FOP-1-0-images-fail-to-render-td7348.html

我的最后一个方法是使用上一篇文章(来自 morjane)中的提示,但这并没有解决我的问题。

<小时/>

有些条形码库存在问题,但我没有使用。

如果有人能给我提示或知道如何解决此错误,我将非常感激。请询问是否需要更多信息。提前致谢。

最佳答案

xercesImpl 添加到我的 pom 解决了问题。

<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>

它还修复了我使用蜡染将 .svg 转换为 .eps 时遇到的以下错误:

org.apache.batik.transcoder.TranscoderException: null Enclosed Exception: SAX2 driver class org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser not found.

关于java - Apache FOP 2.0 - 为什么没有找到 SVG 的 ImagePreloader?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31386864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com