I spent way too much time on this and I can't figure out a good 21th century solution.
Simply I have to generate a business card in PDF with a background image, but MPDF isn't very helpful.
By default I had:
@page{
sheet-size: 90mm 55mm;
margin: 0;
}
I tried to:
- use @page{ background-size: 100%; }
doesn't work
- use @page{ background-size: cover; }
doesn't work
- resize the image - even if I set the right size in 'mm', it will be smaller or larger, even if I set the background-image-resolution to the same value as the image.
- place absolute positioned
div
with background image - same but with
img
tags, usingsrc
attribute.
At the last option, I've got a really strange thing. It showed the whole image but in a small rectangle in the pages, but not even in full height.
Does anyone have an idea, how to simply use an image as a page background?