title: How to print properly HTML table do PDF using jspdf.js?
body: <p>here is what i am trying to achieve, i trying to print a html table that included HTML table inside too loop my detail (i have header and detail) data. But when i use jspdf.js to print my HTML table, the table in the pdf is broken, is not look like the HTML, the looping table inside the main table is messy, look like it won't create the insider table. How to print the table inside table properly?</p>
  
  <p>here is my HTML look like</p>
  
  <p>index.html</p>
  
  <pre><code>    &lt;div id="customers"&gt;
      &lt;div class="table-responsive"&gt;
          &lt;table id="tbl" class="table table-hover"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th style="background-color: #928989; color; white;"&gt;No BPS&lt;/th&gt;
                      &lt;th style="background-color: #928989; color; white;"&gt;Tanggal BPS&lt;/th&gt;
                      &lt;th style="background-color: #928989; color; white;"&gt;Tanggal Input&lt;/th&gt;
                      &lt;th style="background-color: #928989; color; white;"&gt;Status&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;tr ng-repeat-start="listLaporanRetur in listLaporanReturs | limitTo:quantity"&gt;
                      &lt;td class="btn btn-mini btn-primary pull-center"&gt;BPXXXXXXX&lt;/td&gt;
                      &lt;td&gt;2016-06-22&lt;/td&gt;
                      &lt;td&gt;2016-06-22&lt;/td&gt;
                      &lt;td&gt;SENT&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr ng-repeat-end=""&gt;
                  &lt;td colspan="10" style="padding: 0"&gt;
                    &lt;div&gt;
                      &lt;table class="table table-bordered table-hover"&gt;
                          &lt;tr&gt;
                              &lt;td style="background-color: #80A3C1;"&gt;Kode Barang&lt;/td&gt;
                              &lt;td style="background-color: #80A3C1;"&gt;Qty&lt;/td&gt;
                              &lt;td style="background-color: #80A3C1;"&gt;Merk&lt;/td&gt;
                              &lt;td style="background-color: #80A3C1;"&gt;Hasil&lt;/td&gt;
                          &lt;/tr&gt; 
                          &lt;tr ng-repeat-start="details in listLaporanRetur.returDetailList"&gt;
                              &lt;td&gt;STUFFID1&lt;/td&gt;
                              &lt;td&gt;10&lt;/td&gt;
                              &lt;td&gt;APPLE&lt;/td&gt;
                              &lt;td&gt;BOOM&lt;/td&gt;
                          &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td&gt;STUFFID2&lt;/td&gt;
                              &lt;td&gt;40&lt;/td&gt;
                              &lt;td&gt;SONY&lt;/td&gt;
                              &lt;td&gt;BREAK&lt;/td&gt;
                    &lt;/tr&gt;
                          &lt;tr ng-repeat-end=""&gt;&lt;/tr&gt;
                      &lt;/table&gt;
  
                    &lt;/div&gt;
                  &lt;/td&gt;
  
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;button onclick="javascript:demoFromHTML();"&gt;PDF&lt;/button&gt;
  </code></pre>
  
  <p>then here is my javascript</p>
  
  <pre><code>function demoFromHTML() {
      var pdf = new jsPDF('p', 'pt', 'letter');
      // source can be HTML-formatted string, or a reference
      // to an actual DOM element from which the text will be scraped.
      source = $('#customers')[0];
  
      // we support special element handlers. Register them with jQuery-style 
      // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
      // There is no support for any other type of selectors 
      // (class, of compound) at this time.
      specialElementHandlers = {
          // element with id of "bypass" - jQuery style selector
          '#bypassme': function (element, renderer) {
              // true = "handled elsewhere, bypass text extraction"
              return true
          }
      };
      margins = {
          top: 80,
          bottom: 60,
          left: 10,
          width: 700
      };
      // all coords and widths are in jsPDF instance's declared units
      // 'inches' in this case
      pdf.fromHTML(
      source, // HTML string or DOM elem ref.
      margins.left, // x coord
      margins.top, { // y coord
          'width': margins.width, // max width of content on PDF
          'elementHandlers': specialElementHandlers
      },
  
      function (dispose) {
          // dispose: object with X, Y of the last line add to the PDF 
          //          this allow the insertion of new lines after html
          pdf.save('Test.pdf');
      }, margins);
  }
  </code></pre>
  
  <p>here is my jsfiddle <a href="http://jsfiddle.net/ugD5L/126/" rel="nofollow">http://jsfiddle.net/ugD5L/126/</a></p>
  
  <p>how to print the table properly so i don't have to get messy table in the pdf? it's better if you guys can show me with jsfiddle example</p>