图像没有找到块容器的背景图像属性

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

我已经XSLT生成使用Apache FOP PDF模板。我有问题的背景图片不能被发现。我曾尝试绝对路径,相对路径和许多人,但没有任何反应。可以在任何你帮助我吗?

我曾尝试以下路径,但它并没有帮助。 C:/Projects/demo/src/main/resources/certificate.png是绝对路径

  • 背景图像= “C:/Projects/demo/src/main/resources/certificate.png”
  • 背景图像= “文件:/// 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(文件:/// C:/Projects/demo/src/main/resources/certificate.png)”
  • 背景图像= “URL(文件:///./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>
xslt apache-fop
1个回答
1
投票

您需要使用url()和包裹URL在单引号,像这样:

<fo:block-container background-image="url('./certificate.png')" />
© www.soinside.com 2019 - 2024. All rights reserved.