Error loading image with HTML2PDF

4.5k views Asked by At

Well, I'm ussing html2pdf to convert my HTML into PDF but I've one problem when I try to use a like some div background.

Always send me the error:

Fatal error: Imposible cargar la imagen /var/www/mywebsite/topdf/photo.jpg

I try others values like

http://mywebsite/topdf/photo.jpg
/topdf/photo.jpg/

But always have the same error.

If I opened the file who have this, I can see the photo. My file have the code:

    <style>
#mensaje {
    width: 1090px;
    height: 735px;
    background-color: #FFF;
    background-image: url('/var/www/mywebtise/topdf/photo.jpg');
    background-repeat: no-repeat;
}

    </style>

<div id='mensaje'>Hello</div>

What can be my error?

1

There are 1 answers

0
Psyrus On

I think is just for quote :

background-image: url(http://mywebsite/topdf/photo.jpg);

html2pdf is very sensitive