Problem saving multiple tables to PDF

Problem saving multiple tables to PDF

wdupreewdupree Posts: 5Questions: 0Answers: 0
edited September 2011 in TableTools
Hey everyone, hoping someone can help me. I'm trying to get the export to save multiple datatables to PDF. It works for Copy (to clipboard), CSV and Excel - but when I click on the PDF button - it does nothing, no error, no message - nothing. Here's the code for the PDF extend:

[code]
{
"sExtends": "pdf",
"sFileName": "*.pdf",
"bFooter": true,
"sPdfSize": "letter",
"sToolTip": "Save as PDF in Portrait orientation",
"mColumns": "visible",
"fnClick": function (nButton, oConfig, flash) {
var s = stripCarriageReturns(stripMultipleSpaces(stripHTMLTags($('.ReportHeader').html()))) + "\n";
var a = TableTools.fnGetMasters();
for (var i = 0, iLen = a.length; i < iLen - 1; i++) {
s += a[i].that.fnGetTableData(oConfig) + "\n";
}
this.fnSetText(flash, s);
}
},
[/code]

It may also be worth noting that if I use Firebug and break at the fnSetText function that "s" has all of the text it should from all of the tables on the page (it's not null or empty). Anyone have any ideas? Thanks in advance.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The click function for the PDF button is significantly different from the others as the PDF requires more information, and that will need to be taken into account. Have a look at the original here: https://github.com/DataTables/TableTools/blob/master/media/js/TableTools.js#L2261 . Basically recreating that with your modified "s" (nice idea btw) should do it.

    Allan
  • wdupreewdupree Posts: 5Questions: 0Answers: 0
    Allan,

    You weren't kidding! I got everything working but it took a lot more changes than I thought. I PMed you to see if I could send you all the changes so they might be incorporated in to future versions. Thanks for all the help!
This discussion has been closed.