title: jsPDF/AutoTable Generated PDF overlap page width
body: <p>I'm trying to generate a PDF from a big and long HTML table with multiple columns wraping the text of all columns to fit page width. I know that I'm doing something wrong because the final PDF is overlaping page width and not breaking columns texts in new lines.</p>
  
  <p>Can someone help me?</p>
  
  <p>This is my code:</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>$("#btnPDF").click(function(){
   var doc = new jsPDF('l');
  
    var elem = $("#basicTable")[0];
    var res = doc.autoTableHtmlToJson(elem);
    doc.autoTable(res.columns, res.data, {
      startY: 21,
      margin: {horizontal: 14},
      bodyStyles: {valign: 'top'},
      styles: {overflow: 'linebreak', columnWidth: 'wrap'},
      columnStyles: {}
    });
  
    doc.save('table.pdf');
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table id="basicTable"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;iD&lt;/th&gt;
        &lt;th&gt;Client&lt;/th&gt;
        &lt;th&gt;Name&lt;/th&gt;
        &lt;th&gt;Address&lt;/th&gt;
        &lt;th&gt;ZIPCode&lt;/th&gt;
        &lt;th&gt;City&lt;/th&gt;
        &lt;th&gt;State&lt;/th&gt;
        &lt;th&gt;Country&lt;/th&gt;
        &lt;th&gt;Contact1&lt;/th&gt;
        &lt;th&gt;Phone1&lt;/th&gt;
        &lt;th&gt;eMail1&lt;/th&gt;
        &lt;th&gt;Contact2&lt;/th&gt;
        &lt;th&gt;Phone2&lt;/th&gt;
        &lt;th&gt;eMail2&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;1&lt;/td&gt;
        &lt;td&gt;Antonio&lt;/td&gt;
        &lt;td&gt;ANTONIO EN LA DIRECCION2&lt;/td&gt;
        &lt;td&gt;DIRECCION2&lt;/td&gt;
        &lt;td&gt;CP&lt;/td&gt;
        &lt;td&gt;CIUDAD&lt;/td&gt;
        &lt;td&gt;PROVINCIA&lt;/td&gt;
        &lt;td&gt;PAIS&lt;/td&gt;
        &lt;td&gt;Antonio el del nombre más largo del mundo&lt;/td&gt;
        &lt;td&gt;+34666666666666&lt;/td&gt;
        &lt;td&gt;antonio@elcorreomaslargo.com&lt;/td&gt;
        &lt;td&gt;Antonio José el del nombre más largo del mundo&lt;/td&gt;
        &lt;td&gt;+34666666666666&lt;/td&gt;
        &lt;td&gt;antonio@elcorreomaslargo.com&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;button type="button" id="btnPDF"&gt;
    Generate PDF
  &lt;/button&gt;
  
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.debug.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/2.3.2/jspdf.plugin.autotable.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/we4dfhoo/" rel="nofollow noreferrer">JSFiddle</a></p>
  
  <p>Thanks a lot for your help!</p>