eKoopmans / html2pdf.js

Client-side HTML-to-PDF rendering using pure JS.
MIT License
4.15k stars 1.39k forks source link

font size of The converted PDF is same #205

Open where-picturesque opened 5 years ago

where-picturesque commented 5 years ago

hi! why the converted PDF has the same font size,even if dom already set "font-size:26px" image image and how to increase the fontSize of the whole PDF,it looks so small.

thanks for your answer!

vicdaran commented 5 years ago

Try changing the font size before exporting. Once exported, it returns to the original size.

Example:

$("p").css("font-size", "32px");

html2pdf().from(element).set(opt).toPdf().get('pdf').then(function (pdf) { $("p").css("font-size", "26px"); }).save();

sunman07 commented 4 years ago

same question,use js upstairs change fontsize couldn't work out.

Ansul1 commented 3 years ago

@viktordart , it applies those styles to the downloaded pdf but the actual webpage's font size are also changed. Any way to fix it?

vicdaran commented 3 years ago

Hi @Ansul1 the only way I found was that. Before downloading the pdf, I apply the change to the tags that I want to modify. Right after generating the PDF, I change the labels back to the original size. so that the user does not notice this change, I apply a background with a loader.