簡體   English   中英

如何通過XSL FO加載圖像

[英]How to load image by XSL FO

我想通過XSL FO加載圖像並通過Apache FOP生成它。 我使用jboss4,將2個文件xsl fo和image放在jboss / server / conf / resources /中。

<fo:external-graphic
    src="url(\Logo.jpg)"
    content-height="scale-to-fit" height="1.00in" content-width="1.00in"
    scaling="non-uniform" />

Apache FOP生成沒有圖像的PDF,並顯示以下消息:錯誤[FOUserAgent]未找到圖像。 URI :。 (沒有可用的上下文信息)。 我該如何糾正?

我正在使用以下

<fo:block font-weight="normal" text-align="left">
        <fo:external-graphic src="url(file:images/CompanyLogo.png)" content-height="8mm" />
</fo:block>

來自https://xmlgraphics.apache.org/fop/faq.html#MalformedURL

相對文件URL以斜杠開頭,但沒有file:前綴。

即使在Windows上也僅使用正斜杠。

https://xmlgraphics.apache.org/fop/1.1/configuration.html ,相對URI的默認值是相對於當前目錄的。

如果您使用的是FOP配置文件( https://xmlgraphics.apache.org/fop/1.1/embedding.html#config-external ),則應檢查其是否設置了基本目錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM