hello to the whole community, I’m using html2pdf javascript in laravel to extrapolate graphs in pdf format, how can I set page breaks so that everything is arranged on multiple pages? I’ve tried everything but I can’t get it to work. thanks so much in advance community.
This is code :
<script>
$('#btn-one').click(function() {
let div = document.querySelector(".tutto");
html2pdf().from(div).save('dashboard-pers-layout-1.pdf');
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
>Solution :
Assuming you are using html2pdf.js library,
<script>
$('#btn-one').click(function() {
let div = document.querySelector(".tutto");
html2pdf().set({
pagebreak: { mode: 'avoid-all' }
}).from(div).save('dashboard-pers-layout-1.pdf');
});
</script>
reference: https://ekoopmans.github.io/html2pdf.js/#page-breaks