spipu/html2pdf

Image incorrect size in PDF output

tree28 opened this issue · 2 comments

Hello,
Firstly, thank you for creating this great tool - html2pdf is wonderful!

Background: I am sending a document that contains text and a PNG image to output as a pdf. The text and image render correctly in HTML.

Problem: When opening the pdf the text renders correctly but the PNG image does not. The image width and height size attributes seem to have no effect, as a result the PNG image fills the entire page width.

Here is the html image tag used:
<img src="/var/www/html/test_image.png" width="40px">

I have looked for documentation [ here ] but could not find instructions for image sizing.

Your assistance is greatly appreciated in advance.

All,
Anyone who has this problem the solution is to use non-standard HTML.
ie.
<img src="/var/www/html/test_image.png" width=40>

This is confusing and not ideal. I have decided to leave this case open in the hope that an improvement will be made in the future to enable a standard dimension method or css style methods.

Hi, it is the html spec : https://www.w3schools.com/tags/att_img_width.asp

width="40" : valid
width="40px": not valid