dataTable issue in PDF page size and orientation

﹥>﹥吖頭↗ 提交于 2019-12-25 05:19:15

问题


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

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

Screenshot:

code:

    {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');
        }
    }

回答1:


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



来源:https://stackoverflow.com/questions/41805342/datatable-issue-in-pdf-page-size-and-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!