这里最简单的形式是如何将磁盘上的现有PDF附加到动态创建的PDF并将其提供给浏览器,而无需向物理或虚拟文件系统写入任何新内容。
<!--- Create a new PDF and store it in a variable called newPdf --->
<cfdocument format="PDF" name="newPdf">
Content of new PDF here. Content of an existing PDF to be appended below.
</cfdocument>
<!--- Append to the new PDF the contents of the existing PDF located in the same folder as this script and store it in a variable called mergedPdf --->
<cfpdf action="merge" name="mergedPdf">
<cfpdfparam source="newPdf">
<cfpdfparam source="existing.pdf">
</cfpdf>
<!--- Output the merged PDF to the browser --->
<cfcontent type="application/pdf" variable="#ToBinary(mergedPdf)#" reset="true">
(您可能要添加一个<cfheader>
建议如何将PDF应该由浏览器来处理,即inline
或attachment
。)
经过Adobe CF9.0.1测试 – CfSimplicity