Reputation: 1
Hi I am having dynamic html content to print this on jspdf I am using its HTML Function so it wont break on the next page
await pdf.html(tempContainer, {
callback: async(pdf) => {
},
margin: [10, 10, 10, 10], // top, left, bottom, right margins
autoPaging: 'text', // Automatically add new pages if content overflows
x: 0,
y: 50,
// width: 100,
html2canvas: {
scale: 0.5 // Adjusts the resolution of the output
}
});
Problem is I need to add footer image in the end but I dont know how much last page is filled, for now I am adding another page in end adding image any one have suggestion how can I place footer at the end
await html2canvas(footerEle).then(async canvas => {
const imgData = canvas.toDataURL('image/png');
const imgWidth = 190; // A4 page width in mm
const pageHeight = 295; // A4 page height in mm
const imgHeight = (canvas.height * imgWidth) / canvas.width;
let margin = 230
await pdf.addPage();
await pdf.addImage(imgData, 'PNG', 10, margin, imgWidth, imgHeight);
});
I have tried using converting whole html content with footer but in case of multiple page line will break and there no way to give spacing above
Upvotes: 0
Views: 88