Jquery 当表格不存在时,在pdf中添加额外页面';使用Shield UI导出Pdf无法放入该页面

Jquery 当表格不存在时,在pdf中添加额外页面';使用Shield UI导出Pdf无法放入该页面,jquery,pdf,shieldui,Jquery,Pdf,Shieldui,我正在使用ShieldUI将HTML表导出为pdf。在使用时,“我的表格内容”超出了页面大小高度,其余内容对页面隐藏,而不是在第二页中显示 <script> jQuery(function ($) { $("#exportBt").click(function () { var dataSource = new shield.DataSource.create({ data: "#admin-table",

我正在使用ShieldUI将HTML表导出为pdf。在使用时,“我的表格内容”超出了页面大小高度,其余内容对页面隐藏,而不是在第二页中显示

    <script>

jQuery(function ($) {
    $("#exportBt").click(function () {
        var dataSource = new shield.DataSource.create({
            data: "#admin-table",
            schema: {
                type: "table",
                fields: {
                    sno: {type: Number},
                    Name: {type: String},
                    Age: {type: Number},
                    Gender: {type: String},
                    Contact_Number: {type: Number},
                    Boarding_Point: {type: String},
                    Drop_Point:{type: String},
                    Seat_Number:{type: String}
                }
            }
        });

        dataSource.read().then(function (data) {
            var pdf = new shield.exp.PDFDocument({
                author: "PrepBootstrap",
                created: new Date()
            });

            pdf.addPage("a4", "potrait");
            pdf.table(
                    10,
                    10,
                    data,
                    [   {field: "sno", title: "#", width: 20},
                        {field: "Name", title: "Name", width: 100},
                        {field: "Age", title: "Age", width: 20},
                        {field: "Gender", title: "gender", width: 45},
                        {field: "Contact_Number", title: "Contact No", width: 82},
                        {field: "Boarding_Point", title: "Boarding Point", width: 100},
                        {field: "Drop_Point", title: "Drop Point", width: 100},
                        {field: "Seat_Number", title: "Seat No", width: 100}
                    ],
                    {
                        margins: {
                            top: 10,
                            left: 10, 
                            bottom: 10
                        }
                    }
            );

            pdf.saveAs({
                fileName: "PrepBootstrapPDF"
            });
        });
    });
});
</script>
我想将不适合该页的行移动到下一页

下面是我的代码片段:

<script>

jQuery(function ($) {
    $("#exportBt").click(function () {
        var dataSource = new shield.DataSource.create({
            data: "#admin-table",
            schema: {
                type: "table",
                fields: {
                    sno: {type: Number},
                    Name: {type: String},
                    Age: {type: Number},
                    Gender: {type: String},
                    Contact_Number: {type: Number},
                    Boarding_Point: {type: String},
                    Drop_Point:{type: String},
                    Seat_Number:{type: String}
                }
            }
        });

        dataSource.read().then(function (data) {
            var pdf = new shield.exp.PDFDocument({
                author: "PrepBootstrap",
                created: new Date()
            });

            pdf.addPage("a4", "potrait");
            pdf.table(
                    10,
                    10,
                    data,
                    [   {field: "sno", title: "#", width: 20},
                        {field: "Name", title: "Name", width: 100},
                        {field: "Age", title: "Age", width: 20},
                        {field: "Gender", title: "gender", width: 45},
                        {field: "Contact_Number", title: "Contact No", width: 82},
                        {field: "Boarding_Point", title: "Boarding Point", width: 100},
                        {field: "Drop_Point", title: "Drop Point", width: 100},
                        {field: "Seat_Number", title: "Seat No", width: 100}
                    ],
                    {
                        margins: {
                            top: 10,
                            left: 10
                        }
                    }
            );

            pdf.saveAs({
                fileName: "PrepBootstrapPDF"
            });
        });
    });
});
</script>

jQuery(函数($){
$(“#导出BT”)。单击(函数(){
var dataSource=new shield.dataSource.create({
数据:“#管理表”,
模式:{
类型:“表格”,
字段:{
sno:{type:Number},
名称:{type:String},
年龄:{type:Number},
性别:{type:String},
联系人号码:{type:Number},
登机点:{type:String},
放置点:{type:String},
座位号:{type:String}
}
}
});
dataSource.read().then(函数(数据){
var pdf=new shield.exp.PDFDocument({
作者:“预引导”,
创建日期:新日期()
});
pdf.addPage(“a4”、“potrait”);
pdf.table(
10,
10,
数据,
[{字段:“sno”,标题:“#”,宽度:20},
{字段:“名称”,标题:“名称”,宽度:100},
{字段:“年龄”,标题:“年龄”,宽度:20},
{字段:“性别”,标题:“性别”,宽度:45},
{字段:“联系人号码”,标题:“联系人号码”,宽度:82},
{字段:“登机点”,标题:“登机点”,宽度:100},
{字段:“下降点”,标题:“下降点”,宽度:100},
{字段:“座位号”,标题:“座位号”,宽度:100}
],
{
利润:{
前10名,
左:10
}
}
);
pdf.saveAs({
文件名:“PrepBootstrapPDF”
});
});
});
});

从代码中可以看出,我不确定导出机制是否支持此功能。
相反,您可以尝试在页面上显示网格时启用分页,然后在导出时禁用分页。这应该显示所有记录

我尝试这个代码块。如果添加下页边距,文档将通过第二页

    <script>

jQuery(function ($) {
    $("#exportBt").click(function () {
        var dataSource = new shield.DataSource.create({
            data: "#admin-table",
            schema: {
                type: "table",
                fields: {
                    sno: {type: Number},
                    Name: {type: String},
                    Age: {type: Number},
                    Gender: {type: String},
                    Contact_Number: {type: Number},
                    Boarding_Point: {type: String},
                    Drop_Point:{type: String},
                    Seat_Number:{type: String}
                }
            }
        });

        dataSource.read().then(function (data) {
            var pdf = new shield.exp.PDFDocument({
                author: "PrepBootstrap",
                created: new Date()
            });

            pdf.addPage("a4", "potrait");
            pdf.table(
                    10,
                    10,
                    data,
                    [   {field: "sno", title: "#", width: 20},
                        {field: "Name", title: "Name", width: 100},
                        {field: "Age", title: "Age", width: 20},
                        {field: "Gender", title: "gender", width: 45},
                        {field: "Contact_Number", title: "Contact No", width: 82},
                        {field: "Boarding_Point", title: "Boarding Point", width: 100},
                        {field: "Drop_Point", title: "Drop Point", width: 100},
                        {field: "Seat_Number", title: "Seat No", width: 100}
                    ],
                    {
                        margins: {
                            top: 10,
                            left: 10, 
                            bottom: 10
                        }
                    }
            );

            pdf.saveAs({
                fileName: "PrepBootstrapPDF"
            });
        });
    });
});
</script>

jQuery(函数($){
$(“#导出BT”)。单击(函数(){
var dataSource=new shield.dataSource.create({
数据:“#管理表”,
模式:{
类型:“表格”,
字段:{
sno:{type:Number},
名称:{type:String},
年龄:{type:Number},
性别:{type:String},
联系人号码:{type:Number},
登机点:{type:String},
放置点:{type:String},
座位号:{type:String}
}
}
});
dataSource.read().then(函数(数据){
var pdf=new shield.exp.PDFDocument({
作者:“预引导”,
创建日期:新日期()
});
pdf.addPage(“a4”、“potrait”);
pdf.table(
10,
10,
数据,
[{字段:“sno”,标题:“#”,宽度:20},
{字段:“名称”,标题:“名称”,宽度:100},
{字段:“年龄”,标题:“年龄”,宽度:20},
{字段:“性别”,标题:“性别”,宽度:45},
{字段:“联系人号码”,标题:“联系人号码”,宽度:82},
{字段:“登机点”,标题:“登机点”,宽度:100},
{字段:“下降点”,标题:“下降点”,宽度:100},
{字段:“座位号”,标题:“座位号”,宽度:100}
],
{
利润:{
前10名,
左:10,,
底数:10
}
}
);
pdf.saveAs({
文件名:“PrepBootstrapPDF”
});
});
});
});