Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JSPDF和自动表格的标题行问题_Javascript_Pdf_Jspdf_Jspdf Autotable - Fatal编程技术网

Javascript JSPDF和自动表格的标题行问题

Javascript JSPDF和自动表格的标题行问题,javascript,pdf,jspdf,jspdf-autotable,Javascript,Pdf,Jspdf,Jspdf Autotable,我正在尝试使用JSPDF和AutoTable从html表生成PDF文件 在我的示例中,有一个带有两个标题行的html表,如下所示: <table id="table" style="display:none ;"> <thead> <tr> <th >ID</th> <th >First name</th> <th >Last name&

我正在尝试使用JSPDF和AutoTable从html表生成PDF文件

在我的示例中,有一个带有两个标题行的html表,如下所示:

<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>

身份证件
名字
姓
电子邮件
国家
IP地址
IP地址
身份证件
名字
姓
电子邮件
国家
IP地址
但是PDF文件是使用单个标题行生成的。。如何解决这个问题? 还有一个选项是,只使用选定列生成PDF文件。 小提琴在这里:


更新:v3支持多个标题行,因此下面的标题现在不准确


插件不支持开箱即用,但可以用钩子手动完成。不过,我几乎会认为这是个骗局。我所做的是首先增加默认标题的高度,然后简单地在因其而释放的空间中绘制辅助标题。

非常感谢@simon。。我还有一个问题。。是否可以使用选定的列生成pdf。例如,如果我想生成包含“名字”、“电子邮件”和“国家”列的pdf,该怎么办?…真棒的答案@Simon Bengtsson