使用 ColdFusion 从 HTML 生成图像
我有一个 ColdFusion 页面,其中有一个样式化的 HTML 表格。我希望能够做的是设置一个功能,允许我们的客户将表格保存为图像文件,以便在幻灯片放映中使用。我已经阅读了 cfcontent 的一些文档,但是,我开始感觉我需要一个第三方库。我希望有人能对此有所启发。
I have a ColdFusion page with a styled HTML table in it. What I would like to be able to do is set up a feature that allows our customers to save the table as an image file, for use in their slide shows. I have read some of the documentation for cfcontent however, I am beginning to get the feeling that I will need a third party library. I was hoping someone could shed some light on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将 html 表渲染为静态页面,然后调用 http://code.google.com/ p/wkhtmltopdf/ 使用cfexecute渲染为pdf,或者wkhtmltoimage可以转换为.png .gif等
这是一个带有测试表和一些css表的静态页面。cfm
制作一个简单的批处理文件wkhtmltoimage.bat
更多命令行选项此处
使用 cfexecute运行批处理文件
输出非常好
Windows 安装程序 libwkhtmltox-0.10.0_rc2.zip 包含 topdf 和 wkhtmltoimage
You could render your html table to a static page, then call http://code.google.com/p/wkhtmltopdf/ using cfexecute to render to pdf, or wkhtmltoimage can convert to .png .gif etc
Here's a static page with a test table and some css table.cfm
Make a simple batch file wkhtmltoimage.bat
More command line options here
Use cfexecute to run the batch file
Output is pretty nice
The windows installer libwkhtmltox-0.10.0_rc2.zip contains topdf and wkhtmltoimage
查看
和check out
<cfdocument format="PDF">
and<cfpdf action="thumbnail">
可能不完全是你想要的,但 cfsilence 有一个来自 CF8 天的帖子可能有用:
初始帖子:
http:// /cfsilence.com/blog/client/index.cfm/2008/4/4/Converting-HTML-To-An-Image-With-CFJava
跟进:
http ://cfsilence.com/blog/client/index.cfm/2008/4/5/More-Thoughts-on-HTML-To-Image-Plus-Code
可能会帮助您开始......希望它有帮助!
Might not be exactly what you're after but cfsilence has a post from the CF8 days that might work:
Initial Post:
http://cfsilence.com/blog/client/index.cfm/2008/4/4/Converting-HTML-To-An-Image-With-CFJava
Follow Up:
http://cfsilence.com/blog/client/index.cfm/2008/4/5/More-Thoughts-on-HTML-To-Image-Plus-Code
Might get you started ... hope it's helpful!