CFDocument PDF 很大 (ColdFusion 8)
我想为文章添加一个 PDF 生成按钮。一切都运行良好,直到我注意到包含 200KB JPG 图像和大约 120KB HTML 的文档的文件大小高达 4MB 以上。因此,我将 CFDocument 放入 CFPDF 标签中,将其减少到 1.5MB。更好的。然后我通过 Acrobat 的 Web 优化器将其减小到 335KB。我无法使用 CFDocument 或 CFPDF 找到“优化”解决方案。我希望有一个高质量的设置或其他东西。我还应该注意到 CFDocument 需要一段时间来处理(相对而言)。由于ColdFusion 9添加了优化功能,我猜在这台服务器升级之前我运气不好。真的?
<cfdocument format="pdf"
localurl=true
name="loc.tempPDF">
<cfoutput>#loc.articleContent#</cfoutput>
</cfdocument>
<cfpdf action = "write"
destination = "#expandPath('\pdf\temp.pdf')#"
source = "loc.tempPDF"
overwrite = "yes"
saveOption = "linear" />
I wanted to add a PDF generation button for articles. Everything is working well until I noticed that the file sizes are upwards of 4MB for a document with 200KB of JPG images and about 120KB of HTML. So, I tossed the CFDocument into the CFPDF tag which reduced it to 1.5MB. Better. Then I put it through Acrobat's web optimizer which took it down to 335KB. I cannot find an "optimizing" solution with either CFDocument or CFPDF. I was hoping for a quality setting or something. I should also note that CFDocument takes a while to process (relatively speaking). Since ColdFusion 9 added an optimize function, I'm guessing that I'm out of luck until this server is upgraded. True?
<cfdocument format="pdf"
localurl=true
name="loc.tempPDF">
<cfoutput>#loc.articleContent#</cfoutput>
</cfdocument>
<cfpdf action = "write"
destination = "#expandPath('\pdf\temp.pdf')#"
source = "loc.tempPDF"
overwrite = "yes"
saveOption = "linear" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没错,目前无法使用本机
cfdocument
或cfpdf
标签在 ColdFusion 8 中优化 PDF。如果您绝对必须在不升级到 CF9(它大大改进了 PDF 压缩)的情况下实现此目的,那么您可以查看 iText 用于通过 Java 生成 PDF 的库。That's correct, there is currently no way to optimize PDFs in ColdFusion 8 with the native
cfdocument
orcfpdf
tags. If you absolutely have to make this happen without upgrading to CF9 (which has much improved PDF compression), then you could look at the iText library for generating PDFs via Java.几年前,我使用 CF 6.1 构建了一个文档管理系统。我使用 GhostScript 来创建、连接和优化 PDF。
这是一篇博客文章,展示了如何可以使用 GS 优化 PDF 的大小。
I built a Document Management System using CF 6.1 a few years ago. I used GhostScript to create, concatenate and optimize PDFs.
Here's a blog post showing how you can use GS to optimize a PDF's size.