PDF页面大小和方向上的dataTable问题 [英] dataTable issue in PDF page size and orientation

查看:141
本文介绍了PDF页面大小和方向上的dataTable问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用datatable插件导出pdf,csv,xls和打印.我在pdf视图中遇到问题.

I have used datatable plugin for export pdf, csv, xls and print. I have problem in pdf view.

当我单击下载pdf按钮时,我的pdf文件数据未达到全角.请检查此链接- https://datatables.net/extensions/buttons/examples /html5/pdfPage.html

When I click on download pdf button my pdf file data not coming full width. Please check this link - https://datatables.net/extensions/buttons/examples/html5/pdfPage.html

屏幕截图:

代码:

    {extend: 'copy'},
    {extend: 'csv'},
    {extend: 'excel', title: 'DownloadExcel'},
    {extend: 'pdf'},
    {extend: 'print',
        customize: function(win) {
            $(win.document.body).addClass('white-bg');
            $(win.document.body).css('font-size', '10px');
            $(win.document.body).find('table')
                    .addClass('compact')
                    .css('font-size', 'inherit');
        }
    }

推荐答案

尝试将{extend: 'pdf'}更改为{extend: 'pdfHtml5'}并添加orientation:'landscape' 并添加到类compact width:100%;

Try changing the {extend: 'pdf'} to {extend: 'pdfHtml5'} and add orientation:'landscape' and add to class compact width:100%;

这篇关于PDF页面大小和方向上的dataTable问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆