I want to generate a PDF with DOMPDF tool in CodeIgniter.
I have an image and I want to display it in a background full DIN A4 PDF page, when I try to do this:
body{
background-image: url('http://blogs.ucl.ac.uk/quantum/files/2013/12/artwork-fullsize.jpg'); background-position: bottom right; background-repeat: no-repeat;
background-size: 100%;
width:100%;
height:100%;
padding: 0px;
margin: 0px;
}
I have a PDF but it appear a margin (or padding). I want without margin or padding, just a full 100% image background.
Thank you,
dompdf does not yet support the background-size
declaration. The easiest work-around is to absolutely position an image and set the dimensions to those of the page (percent calculations still appear to be a bit off). You have to take into account the page margins, so you should set those as well.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
@page { margin: .5in; }
.bg { top: -.5in; right: -.5in; bottom: -.5in; left: -.5in; position: absolute; z-index: -1000; min-width: 8.5in; min-height: 11in; }
</style>
</head>
<body>
<img class="bg" src="http://eclecticgeek.com/images/macro/ants.jpg">
</body>
</html>
I also stumbled upon your problem long time ago. This what i did to make the page no margins.
<style>@page{margin:0}</style>