我有一个页面,我需要显示一个pdf和一个“我同意”按钮。
问:我是否使用cfpdf来创建pdf的缩略图并显示结果输出?
cfWack 8的第32章讨论了如何使用cfpdf。
发布于 2010-04-30 19:28:58
我在办公室里做过一次……它并不像Adobe的白皮书中描述的那样甜蜜。
下面是我的代码:
<cfpdf source="#attachmentFilePath##attachmentFilename#" pages="1" imagePrefix="#prefix#" action="thumbnail" destination="#application.attachmentsFilePath#/_thumbs" format="jpg" overwrite="true" resolution="low" scale="80">
<cfset thumbURL = "http://127.0.0.1:9001/attachments/_thumbs/#prefix#_page_1.jpg">
<cfif fileExists(thumb)>
<tr>
<td width="100%">
<a href="attachmentView.cfm?attachNo=#attachNo#&act=download">
<img alt="#attachmentFilename#" src="#thumbURL#" width="500" />
</a>
</td>
</tr>
<cfelse>
<cfheader name="Content-Type" value="#attachmentMIMEType#">
<cfheader name="Content-Disposition" value="attachment; filename=#attachmentFilename#">
<cfcontent type="#attachmentMIMEType#" file="#attachmentFilePath##attachmentFilename#">
</cfif>我还检查了isPDF(),并将所有这些放到了try/catch中。
那么这有什么问题呢?它适用于30%的PDF用户正在尝试预览,因此在catch I中显示下载链接而不是图像:(
https://stackoverflow.com/questions/2740390
复制相似问题