html到pdf转换背景图片

时间:2016-04-21 10:08:20

标签: php html pdf yii background-image

我使用yii扩展程序将html转换为pdf,这是我正在使用的HTML代码。

<table cellpadding="0" cellspacing="0" style="width:100%;">
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" style="width:100%;">
                    <tr>
                        <td style="text-align:center; width:100%; padding:35px 0 15px 0;"><img src="<?php echo Yii::app()->baseUrl;?>/images/digest_logo.png" /></td>
                    </tr>
                    <tr>
                        <td style="text-align:center; color:#2d2d2d;">April 18, 2016</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="padding-top:20px;">
                <table cellpadding="0" cellspacing="0" style="width:100%; background:#f3f3f1;">
                    <tr>
                        <td style="width:100%; padding:40px 75px 35px;">
                            <h1 style="margin:0 0 35px 0; font-weight:normal; font-size:24px;">Hi, Patron</h1>
                            <p style="margin:0 0 4px 0; font-size:17px;">Greetings from Crownit,</p>
                            <p style="margin:0 0 4px 0; font-size:17px;">Crown it believes ut is very important to. make</p>
                            <p style="margin:0 0 4px 0; font-size:17px;">Lorem ipsum Lorem ipsumhhhhhhhhh hhhhhn </p>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="background-image:url(<?php echo Yii::app()->baseUrl;?>/images/bg-script.png)">
                sdf
            </td>
        </tr>
    </table>

突然间,我陷入了一个我想使用background-image的地方,因为我的设计是这样的

Image reference

当我在pdf中看到结果时出现此错误

  

无法加载图片C:/xampp/htdocs//var/www/html/insight/insight/images/bg-script.png

我不确定为什么这个背景css在pdf中不起作用,它在浏览器中工作正常。

任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:0)

得到了答案。

此pdf扩展程序支持的CSS很少。

目前,仅支持以下CSS属性:

  • 字体家庭
  • 字体大小
  • 字体重量
  • 字体风格
  • 颜色
  • 背景颜色
  • 文字修饰
  • 宽度
  • 高度
  • 文本对齐

其他标签不起作用。