I have 2 problems, my receipt is very long and when I export the pdf it has a page break, so I am keeping pdfHeight fixed. How can I make pdfHeight calculate the height automatically and not have a page break?
function exportConnectPdf() {
const pdfWidth = 306;
const pdfHeight = 500;
const doc = new jsPDF({
orientation: 'p',
unit: 'px',
format: [pdfWidth, pdfHeight],
});
doc.html(fastConnectPrint.value, {
callback: function (doc) {
doc.save(`Order Receipt #${receipts.value.fast_connect_standalone == null ? receipts.value.data.id : receipts.value.fast_connect_standalone.id}.pdf`);
},
autoPaging: 'text',
html2canvas: {
scale: 1,
useCORS: true,
allowTaint: true,
scrollY: -window.scrollY,
}
});
}
<div id="connect-print" style="display: none;">
<div class="connect-print w-[306px]" ref="fastConnectPrint">
....Long content paragraph follows....
</div>
</div>
<button @click="exportConnectPdf()">export pdf</button>