html2pdf.js
html2pdf.js copied to clipboard
PDF content not generating properly while updating html2pdf version from 0.8.3 to 0.10.1
@eKoopmans We are trying to update the html2pdf version from 0.8.3 to 0.10.1. Following are the changes we had to do in the way we invoke the html2pdf
In V0.8.3
const options = { jsPDF: { unit: 'pt', format: 'a4', orientation: 'p' }, margin: 20 }; this.printableForm = document.getElementById(this.printableFormId); html2pdf(this.printableForm, options);
On updating to V0.10.1, the changes done are as follows
const options = { jsPDF: { unit: 'pt', format: 'a4', orientation: 'p' }, margin: 20, pagebreak: {mode: ['avoid-all', 'css', 'legacy']}
};
html2pdf().from(this.printableForm).set(options).outputPdf('blob').then((result) => { this.saveForm(new Blob([result], {type: "application/pdf"})); // This is a method invoked to save the Blob data });
The PDF generated with this update does not have the full PDF content, the content towards are right are truncated and also the content to the bottom is also truncated. We tried adding page breaks and with that the content was again getting truncated on adding page breaks in between.
Is this the issue with the V0.10.1 or am I missing something while invoking the PDF generator method?