title: Export html table to PDF and preserve the tables look
body: <p>I have the following table:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var currencySymbol = '£'
  var total = 0.0;
  $('table tbody tr:gt(0) td:nth-child(4)').each(function() {
    total += parseFloat($(this).html().replace(currencySymbol, ''));
  });
  
  total += currencySymbol;
  
  var $newTR = $("&lt;tr&gt;&lt;td colSpan='3'&gt;&lt;/td&gt;&lt;td&gt;"+total+"&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;");
  $('table tbody').append($newTR);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.css" rel="stylesheet"/&gt;
  &lt;table class="table table-bordered"&gt;
     &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;Timestamp&lt;/td&gt;
           &lt;td&gt;Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Shop Name&lt;/td&gt;
           &lt;td&gt;Amount&lt;/td&gt;
           &lt;td&gt;Comments&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;10/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;J's Pizza Stop &lt;/td&gt;
           &lt;td&gt;72.75£&lt;/td&gt;
           &lt;td&gt;PAID 2018-01-11 16:53 Full Amount: 75 Discount of 3% Discount Total: 2.25&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;13/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Mexican House&lt;/td&gt;
           &lt;td&gt;93.42£&lt;/td&gt;
           &lt;td&gt;PAID 2018-01-18 10:08 Full Amount: 96.31 Discount of 3% Discount Total: 2.8893&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;14/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Mexican House&lt;/td&gt;
           &lt;td&gt;67.08£&lt;/td&gt;
           &lt;td&gt;PAID 2018-01-18 10:05 Full Amount: 69.15 Discount of 3% Discount Total: 2.0745&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;18/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Mexican House&lt;/td&gt;
           &lt;td&gt;94.00£&lt;/td&gt;
           &lt;td&gt;PAID 2018-01-25 10:34 Full Amount: 96.91 Discount of 3% Discount Total: 2.9073&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;19/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Mexican House&lt;/td&gt;
           &lt;td&gt;48.50£&lt;/td&gt;
           &lt;td&gt;PAID 2018-01-25 10:34 Full Amount: 50 Discount of 3% Discount Total: 1.5&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;20/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Mexican House&lt;/td&gt;
           &lt;td&gt;34.85£&lt;/td&gt;
           &lt;td&gt;PAID 2018-01-25 10:33 Full Amount: 35.93 Discount of 3% Discount Total: 1.0779&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;25/01/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;Eastham Express&lt;/td&gt;
           &lt;td&gt;212.97£&lt;/td&gt;
           &lt;td&gt;PAID 2018-02-01 10:51 Full Amount: 219.56 Discount of 3% Discount Total: 6.5868&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;03/02/2018&lt;/td&gt;
           &lt;td&gt;New Delhi Cash &amp;amp; Carry&lt;/td&gt;
           &lt;td&gt;J's Pizza Stop &lt;/td&gt;
           &lt;td&gt;14.55£&lt;/td&gt;
           &lt;td&gt;Full Amount: 15 Discount of 3% Discount Total: 0.45&lt;/td&gt;
        &lt;/tr&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there a plugin that I can use to export the table to a PDF and preserve its structure and look the way it looks in the example above? So far I've tried using <code>jspdf</code>but didn't manage to preserve the table structure and the examples I've seen on <code>stackoverflow</code> haven't manage to do that as well. Can someone point me to a working example of how to export the table to a PDF and preserve the table's look or show me how such a thing can be done?</p>