Skip to content Skip to sidebar Skip to footer

How To Keep Some Formatting And Paragraphs When Using Jspdf?

Okay, so I have a basic table for a schedule I created for a gym. I want to be able to download that table using jsPDF. As of right now, I've been able to get the table downloadin

Solution 1:

Include html2canvas and then use pdf.addHTML() instead of pdf.fromHTML(). It works great. I used it and it kept all my styles from the page.

Here's my code:

var pdf = newjsPDF('p', 'pt', 'letter');
 pdf.addHTML($('#NameOfTheElementYouWantToConvertToPdf')[0], function () {
     pdf.save('Test.pdf');
 });

Post a Comment for "How To Keep Some Formatting And Paragraphs When Using Jspdf?"