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