How do I change the font size to export the pdf at datatables plug in? I looked at the sources and could not find where does it!
any body can help me?? thanks
How do I change the font size to export the pdf at datatables plug in? I looked at the sources and could not find where does it!
any body can help me?? thanks
As Adam stated, you must modify the action script. In TableTools 2.0.1 the file i the one that Adam stated. In the action script Fonts are defined on line 212 for the title:
pdf.setFont( new CoreFont(FontFamily.HELVETICA), 14 );//14 is the font size
if ( title != "" )
{
pdf.writeText(11, title+"\n");
}
and on line 218 for the other text
pdf.setFont( new CoreFont(FontFamily.HELVETICA), 11 );
if ( message != "" )
{
pdf.writeText(11, message+"\n");
}
There is full reference for the library used to generate the PDF (i point out the font-part) here : http://alivepdf.bytearray.org/alivepdf-asdoc/org/alivepdf/fonts/FontFamily.html
After you have modified the action script you must compile a new copy_cvs_xls_pdf.swf with the command found on top of the action script file: Compile using: mxmlc --target-player=10.0.0 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as
You'll need the Flex 4 SDK to build the SWF - which you can get free from the Adobe open source pages.
I tried it and it works.
You should always check out http://datatables.net/forums/ also, i found this that helped me compile the file!
hope it helps
May be its to late to answer this,but i really didnt find any supporting documents from the author or in any other website regarding tabletools syling techniques...no shame to say i really didnt had much knowledge on actionscript at that point and was searching for a solid document online.But all was in vein.In a nut shell this what you have to do to change styling to the generated pdf
1.Download and install flex sdk 4.
2.Take latest AlivePDF.swc
3.Set path and edit the AS file
I would like to share my experience as well. It might help someone like me who doesn't any background in ActionScript.
Key thing is that the there are two versions ZeroClipboard
class in as3
folder
It's obvious that we would be working with ZeroClipboardPdf.as
file, if we want to change the font size for Pdf exports. However, when I tried the command given at the top on this file
mxmlc --target-player=11.1 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as
Changed --target-player
to 11.1
as per comment above
I got the following error
Error: A file found in a source-path 'ZeroClipboardPdf' must have the same name as the class definition inside the file 'ZeroClipboard'.
So here is what I did
Then, used this command
mxmlc --target-player=11.1 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboard.as
and it generated a file named ZeroClipboard.swf
in as3
folder and I renamed this file to copy_csv_xls_pdf.swf
and used in my project.
Dev Env: Windows 7, Adobe Flex 4.6