Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery DataTables export pdf cuts off columns

I have a dataset with large number of colums.

When exporting the pdf , columns that dont fit on the page get cut off.

I tried using the 'orientation' and 'page-size' options but its not enough.

    buttons: [
                {
                    extend: 'pdfHtml5',
                    orientation: 'landscape',
                    pageSize: 'LEGAL'
                }
            ]

Ideally it should do one of the following:

  1. Fit the data on one page ( making the font really small )
  2. Continue the data in another page in the the pdf
like image 966
ImpendingDoom Avatar asked Aug 15 '16 15:08

ImpendingDoom


2 Answers

thanks @parlad , however Below is the perfect solution -

{
            extend : 'pdfHtml5',
            title : function() {
                return "ABCDE List";
            },
            orientation : 'landscape',
            pageSize : 'A0', // You can also use "A1","A2" or "A3", most of the time "A3" works the best.
            text : '<i class="fa fa-file-pdf-o"> PDF</i>',
            titleAttr : 'PDF'
        } 

pageSize : 'A0', does the trick :), but you can also use A1, A2 or A3, Hope it helps to others.

like image 122
Vivek Chaturvedi Avatar answered Sep 18 '22 13:09

Vivek Chaturvedi


i managed to solve this problem with setting option for pdf like

 {
                extend : 'pdfHtml5',
                title : function() {
                    return "ABCDE List";
                },
                orientation : 'landscape',
                pageSize : 'LEGAL',
                text : '<i class="fa fa-file-pdf-o"> PDF</i>',
                titleAttr : 'PDF'
            } 

enter image description here

became

enter image description here

like image 30
parlad Avatar answered Sep 18 '22 13:09

parlad