FOP 2.3:问题:外部图形

问题描述 投票:0回答:1

这是我的情况,当我在服务器中执行我的Java jar应用程序,而不是直接从IDE。

  1. 我在此路径中有配置文件:C:\ Temp \ myuser \ myappname \ config \ xslt。主要档案是header.jpg,fopfile.xconf和style.stl
  2. 此应用程序调用Zxing库生成qr代码以附加到PDF新文件。我的应用程序在C:\ Temp \ myapp \ myapp.jar中运行,因此png格式的gneerated QRCode文件将保存在名为qrcode.png的路径中。
  3. 我的xsl-fo文件使用臭名昭着的标签fo:external-graphic。对于这两种情况,我使用:

<fo:external-graphic src="url('file:\\C:\Temp\myuser\myappname\config\xslt\header.jpg')"/>

<fo:external-graphic src="url('file:\\C:\Temp\myapp\qrcode.png')"/>

但是,罐子再次粉碎并说GRAVE:每次都找不到图像。我尝试更改路径并发生相同的错误。

现在看,如果我从IDE -VSCode运行这个应用程序 - 这个问题永远不会发生。

请各位帮助我们,我们能做些什么?我从apache中阅读了教程中的所有文档但是没有任何效果。

注意:我通过这个生成jar:mvn clean compile assembly:single -f,所以我创建了opne jar,其中嵌入了所有依赖项。

java jar apache-fop
1个回答
0
投票
    <!--Just put this first dependency **xmlgraphics-commons** before the **fop** dependency-->
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>xmlgraphics-commons</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>fop</artifactId>
        <version>2.3</version>
    </dependency>
© www.soinside.com 2019 - 2024. All rights reserved.