我正在尝试使用cfpdf并继续获取以下错误:
超出范围的字符串索引:-1
我不明白为什么。我在Debian上运行ColdFusion 11。
<CFIF FileExists("#getDirectoryFromPath(getCurrentTemplatePath())#REPORT.pdf")>
<cfpdfform
action="read"
source="#getDirectoryFromPath(getCurrentTemplatePath())#REPORT.pdf" xmldata="x"
result="r">
</cfpdfform>
<cfdump var="#x#" label="XMLData">
<cfdump var="#r#" label="Result">
<CFELSE>
File doesn't exist
</CFIF>准确错误:
String index out of range: -1
The error occurred in /var/www/www.test.com/test.cfm: line 2
1 : <CFIF FileExists("#getDirectoryFromPath(getCurrentTemplatePath())#REPORT.pdf")>
2 : <cfpdfform
action="read"
source="#getDirectoryFromPath(getCurrentTemplatePath())#REPORT.pdf"
xmldata="x" result="r">
3 : </cfpdfform>
4 : <cfdump var="#x#" label="XMLData">发布于 2014-12-03 09:20:30
我过去也有过类似的问题。问题是使用非Adobe程序来创建pdf --例如,在Libreoffice中制作pdf表单会导致这个问题。我假设CF正在寻找的文件中缺少一些内部格式。
您可以尝试在Acrobat中打开并重新保存它。
https://stackoverflow.com/questions/24251155
复制相似问题