我所做的工作如下:
<cffunction name="GenerateTemporaryDocument" access="remote" returntype="string">
<cfargument name="Source" type="string" required="yes" >
<cfargument name="Fields" type="array" required="yes" >
<cfset Source = "\#Source#" >
<cfset pdfName = ".\Generated\#CreateUUID()#.pdf" >
<cfpdfform action="populate"
source="#Source#"
destination="#pdfName#"
overwrite="yes">
<cfpdfform action="populate"
source="#Source#"
destination="#pdfName#"
overwrite="yes">
<!---
some form fields that get filled
--->
</cfpdfform>
<cfpdf action="write"
source="#pdfName#"
destination="#pdfName#"
flatten="yes"
overwrite="true">
<cfpdf action="protect"
source="#pdfName#"
newOwnerPassword ='xxxxx'
permissions = 'AllowPrinting'>
<cfreturn pdfName>
</cffunction>我会说99/100次,效果很好。但是,我经常在“保护”命令行中看到以下错误:
C:\inetpub\wwwroot\Generated\D6DBE4BD-AC16-2D87-C6CC1FDB990820C2.pdf.文件ColdFusion无法删除
它这么做有什么明显的原因吗?如果没有,有什么方法可以让cf等待文件变得可用呢?
发布于 2021-02-15 00:36:36
我发现查理·阿雷哈特和其他人的建议
来自查理·阿雷哈特的第一条评论:
“您实际上不需要使用这些CFPDF*标记创建文件……您可以使用NAME属性(而不是目的)来指示一个变量来保存前一步的输出,然后在后面一步的源中使用该变量。.可能想要故意创建这些文件,但至少如果您只在最后一步创建文件,它可能会解决. /Charlie (服务器故障排除程序,carehart.org)”
以及MarkMetcalf沿着这些思路提出的解决方案。
https://stackoverflow.com/questions/57361586
复制相似问题