Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background image doesn't show in dompdf

Tags:

php

dompdf

For some reason, the background image doesn't show in dompdf no matter what I try. I've put the direct url as well. None of them worked. Can someone with dompdf experience tell me what I need to do?

It's important to note that other images appear just fine. It's only the bakground images that are causing issues. Here is one of the background images:

body{
 font-size:15px;
 background:url(bg.jpg) repeat-x bottom left;
}
like image 545
Refiking Avatar asked Jul 25 '10 23:07

Refiking


1 Answers

Using DOMODF 0.5.1? It's probably having trouble parsing the background shorthand. You could try breaking up the generic background property into the specific properties:

background-image: url(bg.jpg);
background-repeat: repeat-x;
background-position: bottom left;

I also found that sometimes I had to supply a full URL (http://example.com/bg.jpg).

The handling of this property is a little buggy in that version of DOMPDF. You might consider upgrading to the 0.6.0 code base (currently at beta 1). It has a number of improvements over the previous release.

like image 167
BrianS Avatar answered Sep 29 '22 01:09

BrianS