user5384372
user5384372

Reputation:

Header Row Problems with JSPDF and AutoTable

I am trying to generate PDF file from html table using JSPDF and AutoTable.

In my example there is a html table with two header row as follows:

<table id="table" style="display:none ;">
    <thead>
    <tr>
        <th >ID</th>
        <th >First name</th>
        <th >Last name</th>
        <th >Email</th>
        <th >Country</th>
        <th >IP-address</th>
        <th >IP-address</th>

    </tr>
    <tr>
        <th >ID</th>
        <th >First name</th>
        <th >Last name</th>
        <th >Email</th>
        <th> Country</th>
        <th >IP-address</th>

    </tr>
    </thead>
    </table>

But the PDF file is generated with single header row.. how to solve this problem? and one more is there any option to generate PDF file with the selected Column only. Fiddle is here:

https://jsfiddle.net/x22fk0p4/3/

Upvotes: 2

Views: 7228

Answers (1)

Simon Bengtsson
Simon Bengtsson

Reputation: 8151

UPDATE: v3 supports multiple header rows so the below now inaccurate.

The plugin does not support it out of the box, but it can be done manually with the hooks. I would almost consider this a hack though. What I did was first increasing the height of the default header, then simply draw the secondary header in the space that was freed because of it.

Upvotes: 1

Related Questions