Adding Header logo on each page using Jspdf and html2canvas #3057
Unanswered
sandeepseagu
asked this question in
Q&A
Replies: 1 comment
-
const element = document.querySelector(".my-element");
const base64Image = "data:image/png;base64,abc";
pdf.html(element, {
callback(pdf) {
const totalPages = pdf.getNumberOfPages();
for (let pageIndex = 0; pageIndex <= totalPages; pageIndex++) {
pdf.setPage(pageIndex);
pdf.addImage(base64Image, 10, 15, 140, 40); // same thing with "pdf.text()"
}
const pdfBuffer = pdf.output("arraybuffer");
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using html2canvas and Jspdf to create multiple pages based on the HTML. How can I add Headers for each page??
let page_section =document.querySelector(".page1");
let HTML_Width = page_section.offsetWidth;
let HTML_Height = page_section.offsetHeight;
let top_left_margin = 15;
let PDF_Width = HTML_Width + (top_left_margin * 2);
let PDF_Height = (PDF_Width * 1.2) + (top_left_margin * 2);
console.log(HTML_Width,HTML_Height,top_left_margin,PDF_Width,PDF_Height)
Beta Was this translation helpful? Give feedback.
All reactions