使用完整的DIN A4背景图像生成PDF

时间:2016-12-01 09:03:15

标签: css image pdf

我的图像是2480x3508px - 在Photoshop中它也说595.pt和841.9pt或21cm * 29,7cm。

当我在我的模板中将此图像作为背景图像插入并具有以下尺寸并生成pdf时,我得到了奇怪的结果:

<style type="text/css">

    @page {
        margin: 0mm;
        size: 21cm 29.7cm;
    }

    body {
        font-family: 'Helvetica Neue', Arial, sans-serif;
        background-image: url('voucher_AF_A4.jpg');
        background-repeat: no-repeat;

结果如下:http://d.pr/i/ZzN2 - 这不是我的照片。你知道为什么即使图像尺寸相同,图像也比DINA4大得多吗?

我该如何解决这个问题?

谢谢!

2 个答案:

答案 0 :(得分:0)

只需添加:

background-size: cover;

答案 1 :(得分:0)

你尝试过类似的事情吗?

"hello, sally! seen 10/dec/2016" => "ehllo, allsy! eens 01/cde/0126"