未找到块容器的background-image属性的图像 [英] Image not found for background-image attribute of block-container

查看:109
本文介绍了未找到块容器的background-image属性的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用Apache FOP生成pdf的xslt模板.我有找不到背景图像的问题.我尝试了绝对路径,相对路径和许多其他路径,但没有任何反应.你们任何人都可以帮助我吗?

I have xslt template that generates pdf using Apache FOP. I have problem that background image cannot be found. I have tried absolute paths, relative paths and many else, but nothing happens. Could any of you help me ?

我尝试了以下路径,但没有帮助. c:/Projects/demo/src/main/resources/certificate.png是绝对路径

I have tried following paths, but it did not help. c:/Projects/demo/src/main/resources/certificate.png is absolute path

  • background-image ="c:/Projects/demo/src/main/resources/certificate.png"
  • background-image ="file:///c:/Projects/demo/src/main/resources/certificate.png"
  • background-image ="certificate.png"
  • background-image ="./certificate.png"
  • background-image ="url(certificate.png)"
  • background-image ="url(./certificate.png)"
  • background-image ="url(c:/Projects/demo/src/main/resources/certificate.png)"
  • background-image ="url(file:///c:/Projects/demo/src/main/resources/certificate.png)"
  • background-image ="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用单引号引起来,如下所示:

You need to use url() and wrap the URL in single quotes, like so:

<fo:block-container background-image="url('./certificate.png')" />

这篇关于未找到块容器的background-image属性的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆