找不到块容器的背景图像属性的图像
Image not found for background-image attribute of block-container
我有使用 Apache FOP 生成 pdf 的 xslt 模板。我遇到无法找到背景图像的问题。我尝试了绝对路径、相对路径和许多其他路径,但没有任何反应。你们谁能帮帮我吗?
我试过以下路径,但没有帮助。
c:/Projects/demo/src/main/resources/certificate.png 是绝对路径
- 背景图像="c:/Projects/demo/src/main/resources/certificate.png"
- 背景图像="file:///c:/Projects/demo/src/main/resources/certificate.png"
- 背景图像="certificate.png"
- 背景图片="./certificate.png"
- 背景图像="url(certificate.png)"
- 背景图像="url(./certificate.png)"
- 背景图像="url(c:/Projects/demo/src/main/resources/certificate.png)"
- 背景图像="url(file:///c:/Projects/demo/src/main/resources/certificate.png)"
- 背景图片="url(file:///./certificate.png)"
<fo:block-container position="absolute" height="210mm" width="297mm"
background-image="c:/Projects/demo/src/main/resources/certificate.png"
background-position="right" background-color="transparent">
<!-- Name -->
<fo:block-container absolute-position="fixed"
top="95mm">
<fo:block
letter-spacing="8px"
font-size="22pt"
color="#333333"
font-family="BrandonBlack"
text-align="center">
<xsl:value-of select="data/user"/>
</fo:block>
</fo:block-container>
<!-- Course Name -->
<fo:block-container absolute-position="fixed"
top="135mm">
<fo:block
letter-spacing="5px"
font-size="19pt"
color="#7b5f6f"
font-family="BrandonBlack"
text-align="center">
<xsl:value-of select="data/course"/>
</fo:block>
</fo:block-container>
<!-- Date -->
<fo:block-container absolute-position="fixed"
top="189mm" left="214mm">
<fo:block
letter-spacing="2px"
font-size="12pt"
color="#333333"
font-family="BrandonBlack">
<xsl:value-of select="data/date"/>
</fo:block>
</fo:block-container>
</fo:block-container>
您需要使用 url()
并将 URL 括在单引号中,如下所示:
<fo:block-container background-image="url('./certificate.png')" />
我有使用 Apache FOP 生成 pdf 的 xslt 模板。我遇到无法找到背景图像的问题。我尝试了绝对路径、相对路径和许多其他路径,但没有任何反应。你们谁能帮帮我吗?
我试过以下路径,但没有帮助。 c:/Projects/demo/src/main/resources/certificate.png 是绝对路径
- 背景图像="c:/Projects/demo/src/main/resources/certificate.png"
- 背景图像="file:///c:/Projects/demo/src/main/resources/certificate.png"
- 背景图像="certificate.png"
- 背景图片="./certificate.png"
- 背景图像="url(certificate.png)"
- 背景图像="url(./certificate.png)"
- 背景图像="url(c:/Projects/demo/src/main/resources/certificate.png)"
- 背景图像="url(file:///c:/Projects/demo/src/main/resources/certificate.png)"
- 背景图片="url(file:///./certificate.png)"
<fo:block-container position="absolute" height="210mm" width="297mm"
background-image="c:/Projects/demo/src/main/resources/certificate.png"
background-position="right" background-color="transparent">
<!-- Name -->
<fo:block-container absolute-position="fixed"
top="95mm">
<fo:block
letter-spacing="8px"
font-size="22pt"
color="#333333"
font-family="BrandonBlack"
text-align="center">
<xsl:value-of select="data/user"/>
</fo:block>
</fo:block-container>
<!-- Course Name -->
<fo:block-container absolute-position="fixed"
top="135mm">
<fo:block
letter-spacing="5px"
font-size="19pt"
color="#7b5f6f"
font-family="BrandonBlack"
text-align="center">
<xsl:value-of select="data/course"/>
</fo:block>
</fo:block-container>
<!-- Date -->
<fo:block-container absolute-position="fixed"
top="189mm" left="214mm">
<fo:block
letter-spacing="2px"
font-size="12pt"
color="#333333"
font-family="BrandonBlack">
<xsl:value-of select="data/date"/>
</fo:block>
</fo:block-container>
</fo:block-container>
您需要使用 url()
并将 URL 括在单引号中,如下所示:
<fo:block-container background-image="url('./certificate.png')" />