BertR
November 23, 2016, 10:25am
1
What is the trick to get a full background image on the PDF?
What I am trying the image is showing half or is repeating.
I just want to stretch it over the page.
I tried:
Edit the custom css
Edit template css
body {
position: relative;
width: 21cm;
height: 29.7cm;
margin: 0 auto;
color: #3A3A3A ;
background-image: url("…/img/logolarge.jpg");
background-size: 100% 100%;
background-repeat: no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: sans-serif;
font-size: 14px
}
Edit mpdf_helper.php
$mpdf->Image(‘logolarge.jpg’,0,0,210,297,‘jpg’,’’,true, false);
But nothing.
Can someone help pls.
Bert
BertR
November 24, 2016, 9:54pm
2
Does no one has this problem??
sasax
November 25, 2016, 11:36am
3
In your “invoice_template.php” add this line after /head:
<body style="background-image: url('<?php echo base_url(); ?>assets/model.JPG');">
I’ve have made a background in JPG format, and it’s on folder “assets”.
Cheers.
BertR
November 25, 2016, 1:57pm
4
Hi
That is not working.
Only half
sasax
November 29, 2016, 8:24am
5
You must resize the image.
HI. U saying u must resize the picture. But i do not understand why. Is there is a size using CSS ?
I do have the same issue and error saying : Message: Error parsing image file - image type not recognised
Im using the version 1.5.5
twoup
January 27, 2018, 9:05am
7
I use a slightly different approach, by modifying the assets/core/css/custom-pdf.css
file.
The image needs to be scaled to around 142% of A4. The image will by default tend to appear on one side of the page. To combat this, I use the following CSS:
background: url(A4bg.png) repeat right bottom fixed;
The background image file lives in the assets/core/css/
directory.