Changes to copy_xls_csv_pdf.swf never applied
Changes to copy_xls_csv_pdf.swf never applied
![bdezonia](https://secure.gravatar.com/avatar/2e6c19efb2d2c9dfe626e72956b93b16/?default=https%3A%2F%2Fvanillicon.com%2F2e6c19efb2d2c9dfe626e72956b93b16_200.png&rating=g&size=120)
Hello,
I am having trouble changing the default font sizes in PDFs generated by TableTools. I am using TableTools and DataTables in a Rails app via the jquery-datatables-rails gem (version 1.12.2). Via the DataTables debugger link I can see I am using version 2.1.5 of TableTools and I am using version 1.9.4 of DataTables. (We are not yet ready to use a newer version of these tools).
I wish to change the font size of the displayed text within tables. I have determined that I need to edit and recompile the action script files (ZeroClipboard*.as) bundled with the tools. I am using the source from the DataTables/TableTools github project. I am using the make.sh file to generate the copy_xls_csv_pdf.swf file. I have installed the Adobe Flex 4.1 tools.
I am able to build the swf files correctly. I place them in my public/swf folder in my Rails app and in my project I have these definitions in my projects.js.coffee.erb file:
TableTools.DEFAULTS.sSwfPath = "/swf/copy_csv_xls_pdf.swf"
$('.datatable').dataTable({
"sDom": "<'row-fluid'T><'row-fluid'<'span6'l><'span6'f>r><'toolbar'>t<'row-fluid'<'span6'i><'span6'p>>"
"sPaginationType": "bootstrap"
"aaSorting": [[0,'asc']]
"bSort": true
"fnCreatedRow": (row, data, index) ->
dataTablesCustomFunctions(row)
"oTableTools": {
"aButtons": [
{
"sExtends": "xls"
},
{
"sExtends": "pdf",
"sPdfOrientation": "landscape"
}
]
}
})
Using my app I am able to use data tables fine and export excel and pdf correctly. However no matter what changes I make to the ZeroClipboard*.as files (and thus the swf files) the changes never make it into the exported PDFs. However, if the .swf files are deleted from the project Rails complains that the route to the swf files is missing so Rails is loading the path (which I can see via firebug).
Anyhow I cannot determine why the swf file changes are not being used. Its like the actual rendering code is still using some default values and ignoring my swf. I have found copies of the copy_.swf files in a couple installed gems and I have even replaced every copy_.swf in my gem hierarchy with my modified ones. It seems my modified ones are never used.
Can you advise on what could be the problem? I’ve googled over and over with no luck. And I’ve tried everything I can think of. Thanks.
Answers
As an example of changes I tried that did not show up:
In ZeroClipboardPdf.as, in configPdf():PDF:
Just before:
Put this line:
The created PDF does not contain this sentence.
Did you change the font size on this line: https://github.com/DataTables/TableTools/blob/master/as3/ZeroClipboardPdf.as#L209 ?
The
11
in the line above is the line height. See the AlivePDF documentation: http://alivepdf.bytearray.org/alivepdf-asdoc/org/alivepdf/pdf/PDF.html#writeText()Allan
Did you change the font size on this line: https://github.com/DataTables/TableTools/blob/master/as3/ZeroClipboardPdf.as#L209 ?
The
11
in the line above is the line height. See the AlivePDF documentation: http://alivepdf.bytearray.org/alivepdf-asdoc/org/alivepdf/pdf/PDF.html#writeText()Allan
Yes, I've tried that as well. Note that the title example I used before did not show up in the created PDF. It is clear my swf file is not really being used.
If that is the case you might need to clear your SWF cache. The way I check that a particular SWF is being used myself is to use the Flash debug player and the
trace()
function to log messages.Allan