eKoopmans / html2pdf.js

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

for large number of pages the plugin is not working to create pdf #599

Open hermione-e opened 1 year ago

hermione-e commented 1 year ago

for pages more than 70 the plugin is not generating pdf also the css footer properties are getting tampered.

davidnbooth commented 1 year ago

html2pdf.js creates one single html canvas with all of the content and then converts that to a pdf. The problem is that browsers have a limit on how big a canvas can be, so for large documents the pdf ends up just being blank.

html3pdf, which is a fork of this library and shouldn't require any changes to your code, solves this by rendering each page on its own canvas (although this is much slower).

xUrCodeBuddyx commented 7 months ago

html2pdf.js creates one single html canvas with all of the content and then converts that to a pdf. The problem is that browsers have a limit on how big a canvas can be, so for large documents the pdf ends up just being blank.

html3pdf, which is a fork of this library and shouldn't require any changes to your code, solves this by rendering each page on its own canvas (although this is much slower).

I tried to import it but it didn't work. It always says html2pdf is not defined.