niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.58k stars 4.81k forks source link

font-size and line-height different from html to pdf #1728

Open sandroden opened 5 years ago

sandroden commented 5 years ago

Hi, I'm using html2canvas from html2pdf and I just discovered that the rendered pages have probably a different font-size or at least a different line-height. I guess html2pdf let html2canvas manage this rendering, please correct me if I'm wrong.

I'd like to know if I can debug which font-size is really applied and which line-height. Is there a way I can influence it? Reading another issue (that I'm not able to find again) I tried to set style inline but that didn't help.

I'm using html2canvas 1.0.0-alpha.12. Let me know which info may help.

sandroden commented 5 years ago

Please, is there a way I can log which font-size is effectively used? I could generate a modified source with bigger dimensions so that it creates a pdf as I want.

Vero48 commented 4 years ago

I might have encountered the same problem. I used the latest version of html2canvas to generate an image from html. However, the font size of the generated image becomes much bigger if I set the system font size to bigger size. Therefore, I suspect it uses the font size of the mobile system instead of my css font size. Have you solve this problem?

sandroden commented 4 years ago

I'm sorry, I don't remember how exactly I solved this issue. I guess I managed to fill in with inline css style till the moment it worked well enought for the task.