`;
}
downloadPdfBtn.addEventListener('click', () => {
const poaArea = document.getElementById('poa-printable-area');
if(!poaArea) return;
html2canvas(poaArea, {
scale: 2,
useCORS: true,
logging: true,
}).then(canvas => {
const imgData = canvas.toDataURL('image/png');
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({
orientation: 'p',
unit: 'pt',
format: 'a4'
});
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = pdf.internal.pageSize.getHeight();
const canvasWidth = canvas.width;
const canvasHeight = canvas.height;
const ratio = canvasWidth / canvasHeight;
const width = pdfWidth - 80;
const height = width / ratio;
pdf.addImage(imgData, 'PNG', 40, 40, width, height > pdfHeight - 80 ? pdfHeight - 80 : height);
pdf.save('Power_of_Attorney.pdf');
});
});
goToStep(1);
});
