Java FOP xsl fo插入图像
我想在xsl fo文件的头中设置一个图像Java FOP xsl fo插入图像,java,xslt,xsl-fo,apache-fop,Java,Xslt,Xsl Fo,Apache Fop,我想在xsl fo文件的头中设置一个图像 <fo:static-content flow-name="xsl-region-before"> <fo:block text-align="center" line-height="40pt" start-indent = "10.0cm"> <fo:external-graphic height="auto" width="auto" content-height
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="center" line-height="40pt" start-indent = "10.0cm">
<fo:external-graphic height="auto" width="auto" content-height="auto"
content-width="auto" src="url('PDF/logo.png')">
</fo:external-graphic>
</fo:block>
</fo:static-content>
但我发现错误,文件格式不受支持。。。
我尝试png,bmp,gif,jpg,jpeg每次都出现同样的错误
2014年7月15日晚上8:01:26 org.apache.fop.events.LoggingEventListener processEvent
Schwerwiegend:图像不可用。URI:PDF/logo.png。原因:org.apache.xmlgraphics.image.loader.ImageException:不支持该文件格式。未找到PDF/logo.png的图像预加载程序(参见位置13:119)
org.apache.xmlgraphics.image.loader.ImageException:不支持该文件格式。未找到PDF/logo.png的图像预加载程序
有人有主意吗
真诚的Niko我为
src
使用正确的URI
解决了这个问题:
<fo:block>
<fo:external-graphic src="url(file:///D:/logo.png)" />
</fo:block>
阅读规范XSL
:URI
定义:这与FOP上下文的初始化有关。我不这么认为。您确定您的文件(即所谓的logo.png)实际上是一个png图像吗?检查它,看看它实际上是什么,我打赌它不是PNG。它是什么意思。。。你试过“png,bmp,gif,jpg,jpeg”?你试过什么?哪里