2010-04-29 56 views
1

我有一个页面,我需要显示一个PDF和“我同意”按钮。使用cfpdf来显示pdf文件

问:我是否使用cfpdf创建pdf的缩略图并显示结果输出?

cfWack 8的第32章讨论了使用cfpdf。

+0

我猜,或只是显示PDF(但需要假设PDF阅读器浏览器插件安装) – Henry 2010-04-29 20:18:22

+0

任何 – 2010-05-04 10:00:31

回答

1

我在办公室曾经这样做过......这不是那么甜美,因为它在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用户试图预览,所以在捕捉我的显示链接下载而不是图像:(

+0

我采取了一种新的方法,我隐藏了“我接受”按钮,直到他们点击链接到pdf。 – 2010-05-04 14:38:12