eKoopmans / html2pdf.js

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

problem about a large number of pages are processed #135

Open luo-geng opened 6 years ago

luo-geng commented 6 years ago

When a large number of pages are processed, the output is empty. I tried to intercept part of elemnet printing, and it turned out to be normal.

so, i wanna kown how big date html2pdf deal with

luo-geng commented 6 years ago

44p fail 2p success

thejoshcrawford commented 6 years ago

I was noticing this same behavior.

talkshowhost commented 6 years ago

I posted an issue that might me related to this one #128

Ljuka commented 6 years ago

I think the limit is 15 pages. If I try to insert 16th page it crashes. Also, content doesn't matter because even if I putted on each page one sentence or fill all pages it behaves same (only white pages appears).
This is example of options I am using:

var opt = {
                margin:       0,
                filename:     'myfile.pdf',
                image:        { type: 'jpeg', quality: 0.98 },
                html2canvas:  { scale: 2 },
                jsPDF:        { unit: 'in', format: 'a4', orientation: 'portrait' }
                };

@eKoopmans can you tell us why this is happening and is there any solution for this? :confused:

Greensahil commented 6 years ago

I have 21 pages and it is working fine for me. One thing I have realized is that if you want more pages the orientation has to be in portrait and scale must be set to 1.

Ljuka commented 6 years ago

@Greensahil you are right but if I set scale to 1 I get this error message: Uncaught (in promise) Error: Supplied data is not a JPEG But when I set it to something bigger than 1 (for example 1.1) it works. Also, putting bigger numbers for scale works on less pages, so 1.1 will work on 15-20 but it will not work on 100 pages, which is still not good... Have u tried with 100 pages and can u try it and see if some solution will pop out to u?