How to format exported pdf using 'pdfFlash' button ?

How to format exported pdf using 'pdfFlash' button ?

PuneetPuneet Posts: 6Questions: 3Answers: 0
edited September 2015 in Free community support

Hi,
I was trying to import datatable to pdf and I found the solution with 'pdfFlash' button(I tried with 'pdf' and 'pdfHtml5' buttons as well but I was getting javascript exception "Uncaught TypeError: Cannot read property 'length' of null" in "pdfmake.min.js" .). Now I am able to generate pdf file by clicking on pdf button but it is not formatted(My table is having 23 columns in it). SO is there any way to formate the pdf file. My datatable definition is :

table = $(".jqueryDataTable").DataTable( {          
                        "searching": false,
                    "retrieve": true, 
                    "destroy": true,
                    "ajax": "./getReportDetails",
                    "jQueryUI": true,
                    "dom": 'Bfr<"H"lf><"datatable-scroll"t><"F"ip>',
                    buttons: [
                               'copyHtml5',      //buttons for export
                              'excelHtml5',
                              'csvHtml5',
                              'pdfFlash'
                          ],
                    "fnServerParams": function ( data ) {
                        newData=data;
                        newData.push( { "name": "reportType", "value": reportType }, { "name": "reportSubType", "value": reportSubType}, { "name": "fromDate", "value": fromDate}, { "name": "toDate", "value": toDate});
                    },
                    "columns": [
                                    { "mData": "username", "sTitle": "username"},
                                    { "mData": "transferType", "sTitle": "transferType"},
                                    { "mData": "fromAccount", "sTitle": "fromAccount"},
                                    { "mData": "toAccount", "sTitle": "toAccount"},
                                    { "mData": "amount", "sTitle": "amount"},
                                    { "mData": "currency", "sTitle": "currency"},
                                    { "mData": "transferDate", "sTitle": "transferDate"},
                                    { "mData": "creditDebitFlag", "sTitle": "creditDebitFlag"},
                                    { "mData": "fromAccountType", "sTitle": "fromAccountType"},
                                    { "mData": "toAccountType", "sTitle": "toAccountType"},
                                    { "mData": "impsChannelType", "sTitle": "impsChannelType"},
                                    { "mData": "impsTranType", "sTitle": "impsTranType"},
                                    { "mData": "IFSCCode", "sTitle": "IFSCCode"},
                                    { "mData": "narration", "sTitle": "narration"},
                                    { "mData": "customerID", "sTitle": "customerID"},
                                    { "mData": "customerName", "sTitle": "customerName"},
                                    { "mData": "fromMMID", "sTitle": "fromMMID"},
                                    { "mData": "fromMobileNo", "sTitle": "fromMobileNo"},
                                    { "mData": "toMMID", "sTitle": "toMMID"},
                                    { "mData": "toMobileNo", "sTitle": "toMobileNo"},
                                    { "mData": "paymentType", "sTitle": "paymentType"},
                                    { "mData": "transReferenceId", "sTitle": "transReferenceId"},
                                    { "mData": "transactionStatus", "sTitle": "transactionStatus"}
                        ]
                } ); 

Please let me know about what is issue with other pdf buttons and how to generate formatted pdf file ?

Answers

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin

    Per the forum rules, can you please link to a test case showing the issue so it can be debugged.

    The Flash created PDF is very difficult to format since you'll need to modify the AS3 code and recompile it (plus the PDF creation library used doesn't have the easiest API...).

    I would suggest trying to get the HTML5 PDF export working if possible - but again I'd need a link to a test case.

    Allan

  • PuneetPuneet Posts: 6Questions: 3Answers: 0

    I tried with HTML5 PDF button but I was getting error as : "Uncaught TypeError: Cannot read property 'length' of null" in "pdfmake.min.js" file.
    Can you give me reference for the test case sample sheet or something ?

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin

    There are a number of examples available here.

    Allan

This discussion has been closed.