I am using html2pdf to download a PDF of my website. The downloaded PDF is 14 pages long. After about 12 pages I can see that the elements that had colors are no longer there. If I try to download the PDF on a mobile screen this starts even sooner at around 6 or 7th page. There are no colors anymore and some of the input elements are missing.
Is there a way for html2pdf to handle larger content?
This is my setting right now
var element = document.getElementById('element-to-print');
var opt = {
margin: 0,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale:1 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
html2pdf(element).set(opt)
I tried increasing the quality to 2 from 0.98 but nothing changes.
You can use web workers to download the file in the background without impacting user experience. See this StackOverflow answer for a detailed example.
Try reducing the scale
in the html2canvas
option. Helped me get the colors on all pages.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.