title: how to use html2canvas and jspdf to export to pdf in a proper and simple way
body: <p>I am currently working on a school management software that usually requires exporting of html contents that contains <code>data tables</code> and <code>div tag</code>. </p>
  
  <p>I have tried all possible means to write a code that will be able to export my html data in a good way, with css preferably. After checking some question and answers here, I tried using spdf, but no luck. </p>
  
  <p>It keeps destroying my table alignment, then I read about <code>html2canvas</code> but to implement it with <code>jspdf</code> was my problem, i would like to capture the content if a div tag with <code>html2canvas</code> then send the canvas to <code>jspdf</code> to export the canvas as pdf. </p>
  
  <p>Here is my code below:</p>
  
  
  
  <pre><code>&lt;script src="assets/js/pdfconvert/jspdf.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/jspdf.plugin.from_html.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/jspdf.plugin.split_text_to_size.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/jspdf.plugin.standard_fonts_metrics.js"&gt;  &lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/jspdf.plugin.addhtml.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/filesaver.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/jspdf.plugin.cell.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/html2canvas.js"&gt;&lt;/script&gt;
  &lt;script src="assets/js/pdfconvert/jspdf.plugin.addimage.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>here is the js code</p>
  
  <pre><code>var pdf = new jsPDF('p', 'pt', 'letter');
  pdf.addHTML($('#ElementYouWantToConvertToPdf')[0], function () {
  pdf.save('Test.pdf');
  });
  </code></pre>