skip to Main Content

I have an image which is 2480x3508px – in Photoshop it says also 595.pt and 841.9pt or 21cm * 29,7cm.

When I insert this image as a background image in my template with the following dimensions and generate a pdf I get weird results:

<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;

The result looks like this: http://d.pr/i/ZzN2 – which is not the picture I have. Do you know why the image is much larger than the DINA4 even when the image has the same dimensions?

How can I fix this?

Thanks!

2

Answers


  1. Just add:

    background-size: cover;
    
    Login or Signup to reply.
  2. Have you tried with something like:

    @page {
        margin: 0mn;
        size: 21cm 29.7cm;
    }
    
    body {
        font-family: 'Helvetica Neue', Arial, sans-serif;
        background-image: url('voucher_AF_A4.jpg');
        background-repeat: no-repeat;
        background-position: top left;
        background-size: 100%;
        width:100%;
        height:100%;
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search