Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xhtml2pdf does not show image always

I use xhmtl2pd tool to convert html to pdf. Here is a piece of my html

<tr>
    <td style="width:10px;vertical-align:top">&bull; </td>
    <td style="padding:0 0 5px 0;width:200px;display:inline-block">
        blah blah <br/>              
        <img src="images/little-gray-arrow.png" height="10" width="11" alt="blah" /> 
    </td>
</tr>

The bizarre thing is if I remove the br tag then the image of little-gray-arrow.png never shows up. Put the br tag back, the image shows up in the "next" line. I have tried with all options, padding, margin, and none works.

I also try to inline-displaying an image between text, and the image clock.png bottom half always get cut off, regardless what I tried.

<tr>
    <td style="width:10px;vertical-align:top">&bull; </td>
    <td style="padding:0 0 5px 0;width:200px;">
        Wait
        <img src="images/clock.png" height="20" width="20" alt="20" />
        minutes
    </td>
</tr>

Does anyone know how to solve this problem and it is just the way xhmtl2pdf is. Can the xhtml2pdf display image inline?

Thanks

like image 976
Nghi Vo Avatar asked Apr 28 '26 12:04

Nghi Vo


1 Answers

Dont use absolute paths in url or src. Use fullpath like https://abcd.com/.../image.png . It worked for me

like image 53
Sourav Purkait Avatar answered May 01 '26 16:05

Sourav Purkait



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!