Open ghost opened 2 years ago
var element = document.getElementById('order-table');
In this order table i have header and footer i want to print that on every page of pdf
By using this html2pdf.js
if from this library it can't achieve please suggest something
@ghost try this
var header = document.getElementById('HeaderId');
html2pdf().from(header ).toImg().get('img').then(function (img) {
html2pdf().from(element).toPdf().get('pdf').then(function (pdf) {
var totalPages = pdf.internal.getNumberOfPages();
for (var i = 1; i <= totalPages; i++) {
pdf.setPage(i);
if (i != 1) {
pdf.addImage(img, 'JPEG', 6, 0, pdf.internal.pageSize.getWidth() - 12, 0);
}
pdf.text(30, pdf.internal.pageSize.getHeight() - 1, 'FooterText');
}).get('pdf').save()
@RizTyagi tried this but the footer is still not showing. Is there any updates on how to put the header and footer on the pdf?
I have a header and footer in my Html element ID I want to print that on every page of the pdf