1

I have a div which contains some data and a table. The problem I'm facing now is that jspdf is ignoring the second column of the table and only printing the first column of each row. The following is the HTML and JS

<div id="myDiv">
    <p id="bypassme">Some text</p>
    <p>Some more text</p>
    <table>
        <tr>
            <td>First</td>
            <td>Second</td>
        </tr>
        <tr>
            <td>Third</td>
            <td>Fourth</td>
        </tr>
    </table>
</div>


<script type="text/javascript">
    var doc = new jsPDF('p', 'pt', 'letter');
    var html = $('#myDiv').html();      
    var specialElementHandlers = {
         '#bypassme': function(element, renderer){
             return true;
          }
    };
    doc.fromHTML(html,10,10, {
            'width': 500,
            'elementHandlers': specialElementHandlers
         });
    doc.save("Test.pdf");
</script>

What is seen on page:

Some text
Some more text
+-------+--------+
| First | Second |
+-------+--------+
| Third | Fourth |
+-------+--------+

Actual output

Some more text
First
Third

Expected output

Some more text
First     Second
Third     Fourth
asprin
  • 8,931
  • 10
  • 58
  • 107
  • You already have all in other topic: http://stackoverflow.com/questions/23035858/export-html-table-to-pdf-using-jspdf –  Sep 23 '16 at 07:47
  • I beg to differ. That only works when the data in question contains only a table. In my case, it's a combination of table and some other HTML tags – asprin Sep 23 '16 at 08:56

0 Answers0