kempsteven / vue-html2pdf

vue-html2pdf converts any vue component or element into PDF, vue-html2pdf is basically a vue wrapper only and uses html2pdf.js behind the scenes.
https://www.npmjs.com/package/vue-html2pdf
MIT License
432 stars 75 forks source link

VueHtml2PDF not rendering some elements #137

Open ccperegrine opened 2 years ago

ccperegrine commented 2 years ago

I have a fairly complex report that I aim to export using VueHTml2Pdf - All seemed to be going ok until I added a section which has to loop through data, creating a dynamic page for each grouping.

I noticed that once this report got slightly larger then it just stopped rendering certain elements. In the screenshots attached, the 'circle' div on the right hand table stops showing. Everything still renders as expected on the screen , but just doesn't show up in the pdf. At points while I have been looking for workarounds, I have also seen sections of the charts not rendering correctly . It appears to reach a certain point in the report and just stop rendering certain elements from then on

I have managed to temporarily fix this by changing the option :pdf-quality to 1 from 2, which then allows the whole report to render as expected, but this is not ideal as we would be looking to print the report and this loses quite a lot of quality on the images in other sections. I am also concerned that as the report grows further I will have to reduce this further, which isn't really a viable option

Is there a limit on how much data this can handle, and if so, is there a way of generating sections of the report individually, and then combining all the pages at the end into a single report?

Update

Resolved using the core html2pdf library by generating page by page, using this solution:

https://github.com/eKoopmans/html2pdf.js/issues/19#issuecomment-455868274