如何更改数据表插件中导出pdf的字体大小

发布于 2024-10-29 15:42:17 字数 123 浏览 4 评论 0原文

如何更改字体大小以在 数据表插件 中导出 pdf? 我查看了来源,找不到它在哪里!

任何人都可以帮助我吗? 谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一袭白衣梦中忆 2024-11-05 15:42:17

正如 Adam 所说,您必须修改操作脚本。在 TableTools 2.0.1 中,该文件是 Adam 所说的文件。
在动作脚本中,标题的字体在第 212 行定义,

        pdf.setFont( new CoreFont(FontFamily.HELVETICA), 14 );//14 is the font size
        if ( title != "" )
        {
            pdf.writeText(11, title+"\n");
        }

其他文本的字体在第 218 行

        pdf.setFont( new CoreFont(FontFamily.HELVETICA), 11 );
        if ( message != "" )
        {
            pdf.writeText(11, message+"\n");
        }

定义。这里有用于生成 PDF 的库的完整参考(我指出了字体部分): http://alivepdf.bytearray.org/alivepdf-asdoc/org/alivepdf/fonts/ FontFamily.html

修改操作脚本后,您必须使用操作脚本文件顶部的命令编译新的 copy_cvs_xls_pdf.swf:
编译使用: mxmlc --target-player=10.0.0 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as

您需要 Flex 4 SDK 来构建 SWF - 您可以从 Adob​​e 开源页面免费获取。

我尝试过并且有效。

您应该始终查看 http://datatables.net/forums/ 另外,我发现 这个帮助我编译了文件!

希望有帮助

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

三月梨花 2024-11-05 15:42:17

字体文本直接在Flash中渲染,不能用CSS修改。您需要修改 TableTools 的 ActionScript 文件才能更改字体大小。

它位于

<Datatables Location>/extras/TableTools/media/as3/ZeroClipboardPdf.as

The font text is rendered directly in Flash, and can not be modified with CSS. You would need to modify the ActionScript file for TableTools to change the font size.

It is located in

<Datatables Location>/extras/TableTools/media/as3/ZeroClipboardPdf.as
飘然心甜 2024-11-05 15:42:17

回答这个问题可能已经太晚了,但我确实没有从作者或任何其他网站上找到任何有关 tabletools syling 技术的支持文档...毫不羞耻地说,我当时确实对 ActionScript 没有太多了解,并且正在搜索在线提供可靠的文档。但一切都很顺利。简而言之,您需要做的就是更改生成的 pdf 的样式

1.下载并安装 flex sdk 4.

2.获取最新的 AlivePDF.swc

3.设置路径和编辑AS文件

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

唱一曲作罢 2024-11-05 15:42:17

我也想分享我的经验。它可能会对像我这样没有任何 ActionScript 背景的人有所帮助。

关键是 as3 文件夹中有两个版本的 ZeroClipboard 类,

  • 一个在 ZeroClipboard.as 文件中,
  • 另一个在 ZeroClipboardPdf.as 文件中

很明显,我们将使用 ZeroClipboardPdf.as 文件,如果我们想更改 Pdf 导出的字体大小。 尝试在此文件顶部给出的命令

mxmlc --target-player=11.1 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as

但是,当我按照上面的评论

--target-player 更改为 11.1 时,我收到以下错误

Error: A file found in a source-path 'ZeroClipboardPdf' must have the same name as the class definition inside the file 'ZeroClipboard'.

所以这就是我的内容确实

  • 将名称为“ZeroClipboard.as”的文件更改为“ZeroClipboardNonePdf.as”
  • 将名称为“ZeroClipboardPdf.as”的文件更改为“ZeroClipboard.as”

然后,使用此命令

mxmlc --target-player=11.1 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboard.as

,它生成了一个名为 ZeroClipboard.swf 位于 as3 文件夹中,我将此文件重命名为 copy_csv_xls_pdf.swf 并在我的项目中使用。

开发环境:Windows 7、Adobe Flex 4.6

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

  • one in ZeroClipboard.as file
  • other in ZeroClipboardPdf.as file

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

  • changed file with name 'ZeroClipboard.as' to 'ZeroClipboardNonePdf.as'
  • changed file with name 'ZeroClipboardPdf.as' to 'ZeroClipboard.as'

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文