Skip to content Skip to sidebar Skip to footer

JsPdf Page Break Not Working

I have this very simple code that works with jspdf and html2pdf but for some reason jspdf is not breaking the elements into new pages. Any help would be appreciated

Solution 1:

JsPDF uses a special HTML tag...

<!--ADD_PAGE-->

...to force a page-break.
Please note that this only applies if using the addHTML method.
I had this exact problem and throwing in the tag worked perfectly.


Solution 2:

Can you please check this pagebreak: { mode: 'avoid-all'}, i have tested in multi page pdf consisting of 10+ pages. it works fine for me.

 var opt = {
        margin: 1, 
        filename: 'ontract.pdf',
        image: { type: 'jpeg', quality: 0.98 },
        html2canvas: {scale:2 },
        jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' },
        pagebreak: { mode: 'avoid-all', after: '.avoidThisRow' }       
    };

Post a Comment for "JsPdf Page Break Not Working"