我使用的是ColdFusion7的<cfdocument>标签,使用CFEclipse并开发MacOS。我编写了以下代码:
<cfdocument format="pdf">
SitePoint.com - Introduction to ColdFusion 7
PDF Generation
This is an example of PDF generation using ColdFusion 7.
</cfdocument>,但它没有要求我以.pdf格式保存这个文件,而是尝试以.cfm格式打开它。,如何以.pdf格式保存它?谢谢!
发布于 2010-02-12 19:29:21
除非另有说明,否则text服务器将CFM调用的结果作为文本返回。您需要使用CFContent和CFHeader来提醒浏览器它将收到的结果是不同类型的。类似于:
<cfheader name="Content-Disposition" value="inline; filename=document.pdf">
<cfcontent type="application/x-pdf">
<cfdocument>...</cfdocument>我的哑剧类型可能弄错了。我是从记忆里做的。检查文档以获得更多的帮助。
发布于 2010-02-12 19:32:47
如果您使用的是CF8或更高版本,则使用saveAsName属性:
<cfdocument saveAsName=""或者以上Ben建议的方法都是有效的。
发布于 2012-04-22 23:16:33
您可能还需要导入样式表。这样您就可以获得所需的格式。它需要在cfdocument之后导入。
<cfdocument
format="pdf"
filename = "canwriteurfile.pdf"
overwrite = "yes"
marginBottom = ".2"
marginLeft = ".4"
marginRight = ".4"
marginTop = ".2">
<style type="text/css">@import "pdf.css";</style>
BLAHHH BLAHHH PDF FORMATTING STUFF
</cfdocument>https://stackoverflow.com/questions/2253474
复制相似问题