PDF with many columns get cut short

PDF with many columns get cut short

javismilesjavismiles Posts: 205Questions: 38Answers: 3

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

  • javismilesjavismiles Posts: 205Questions: 38Answers: 3

    this doesnt happen with Excel, it happens with PDF

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • javismilesjavismiles Posts: 205Questions: 38Answers: 3

    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?

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓
  • javismilesjavismiles Posts: 205Questions: 38Answers: 3

    Wonderful, yes, that fixed it, thank u Kevin

  • jagandadijagandadi Posts: 1Questions: 0Answers: 0

    my table columns are getting cut even with legal and landscape mode. is there any other solution?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • donthottakathdonthottakath Posts: 1Questions: 0Answers: 0

    buttons: [
    { extend: 'copyHtml5'},
    { extend: 'excelHtml5'},
    { extend: 'csvHtml5'},
    {
    extend : 'pdfHtml5',
    title : function() { return "Asset List";},
    orientation : 'landscape',
    pageSize : 'LEGAL',
    text : 'PDF',
    titleAttr : 'PDF'
    },
    { extend: 'print'}
    ]

  • riji2312riji2312 Posts: 3Questions: 1Answers: 0
    edited October 2019

    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.

    {
        extend : 'pdfHtml5',
        title : "Hardware",
        orientation : 'landscape',
        pageSize : 'LEGAL',
        exportOptions: {
                  columns: [ 1,2,3,4,5,6,7,8,9,10 ]
             }
    },
    

    You can also use this method to cut down table to n parts and make n pdf export buttons.

This discussion has been closed.