<script>
const button = document.getElementById('download-button');
function generatePDF() {
// Choose the element that your content will be rendered to.
const element = document.getElementById('invoice');
// Choose the element and save the PDF for your user.
var opt = {
filename: 'test.pdf',
image: { type: 'jpeg', quality: 1.2 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'a4', orientation: 'portrait'}
};
// Choose the element and save the PDF for your user. html2pdf().set(opt).from(element).save();
}
button.addEventListener('click', generatePDF);