PDF with many columns get cut short
PDF with many columns get cut short
exporting to PDF with PDF button, and many cells horizontally
buttons: [
{
extend: 'pdfHtml5',
text: 'PDF',
exportOptions: {
columns:[1,2,3,4,5,6,8,10,15,16,17,18,19],
modifier: {
page: 'current'
}
}
},
problem is, the PDF output cuts out after a few cells, basically it includes just the cells that fit and cuts out the rest, how can we include all the columns I specified? thank u
This question has an accepted answers - jump to answer
Answers
this doesnt happen with Excel, it happens with PDF
Do you mean that the table doesn't fit into the page horizontally? Unfortunately there is no work around that I am aware of for that in pdfmake. The closest we've found is to set the page orientation to be landscape to allow more space. You can also optionally use a large paper size - A3 for example.
Allan
thats right, it doesnt fit and it gets cut out,
how can I specify that the PDF is generated in landscape mode? that would probably fix it, but I see no option to specify that?
This example will show you:
https://datatables.net/extensions/buttons/examples/html5/pdfPage.html
Kevin
Wonderful, yes, that fixed it, thank u Kevin
my table columns are getting cut even with legal and landscape mode. is there any other solution?
Not really. Bigger paper size and a smaller font size are the only two I can think of without messing around with how pdfmake is laying out the table.
Allan
buttons: [
{ extend: 'copyHtml5'},
{ extend: 'excelHtml5'},
{ extend: 'csvHtml5'},
{
extend : 'pdfHtml5',
title : function() { return "Asset List";},
orientation : 'landscape',
pageSize : 'LEGAL',
text : 'PDF',
titleAttr : 'PDF'
},
{ extend: 'print'}
]
I have a roundable way of fixing it: using
exportOptions
to specify columns you need to print, thus reduce number of columns on my pdf file.You can also use this method to cut down table to n parts and make n pdf export buttons.