【问题标题】:Add Next Page when exporting PDF with ShieldUI使用 ShieldUI 导出 PDF 时添加下一页
【发布时间】:2018-08-28 11:45:54
【问题描述】:

当我尝试使用 ShieldUI 将页面中的表格中的数据导出到 PDF 时遇到问题。 在我的页面中显示了 200 行数据,但是当我导出为 pdf 时,它只显示 16 行数据并且只有一个页面,它隐藏了另一个应该在下一页中的数据。

这是我的代码

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

        pdf.addPage("a4", "portrait");

        pdf.table(
            10,
            20,
            data,
            [
                { field: "No", title: "No.", width: 30 },
                { field: "Nama", title: "Nama", width: 100 },
                { field: "Prodi", title: "Prodi", width: 70 },
                { field: "HP", title: "Nomor HP", width: 100 },
                { field: "Alamat", title: "Alamat", width: 100 },
                { field: "Gugus", title: "Gugus", width: 80 },
                { field: "Kepribadian", title: "Kepribadian", width: 100 }
            ],
            {
                margins: {
                    top: 50,
                    left: 50
                }
            }
        );

        pdf.saveAs({
            fileName: "Data Seluruh Peserta PETA FT UHAMKA 2018"
        });
    });
});

我该怎么办?

【问题讨论】:

    标签: jquery html pdf shieldui


    【解决方案1】:

    如果您使用网格,您可以查看this example configuration 了解如何导出整个数据集。

    如果您使用独立的数据源,则必须先重置任何分页(可能在没有设置任何分页选项的情况下复制 DS),然后再将其传递给 PDF 实用程序。

    【讨论】:

      【解决方案2】:

      在空白处添加:

      margins: {
                top: 50,
                left: 50,
                bottom: 50
           }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-04-20
        • 2013-02-28
        • 1970-01-01
        • 2019-12-13
        • 1970-01-01
        相关资源
        最近更新 更多