Verifies whether a PDF file is valid.
True, if the value returns a valid PDF file. False, otherwise.
IsPDFFile("path")
ColdFusion 8: Added this function.
Parameter |
Description |
|---|---|
path |
Pathname to an on-disk or in-memory PDF file. The pathname can be absolute or relative to the CFM page and must be enclosed in quotation marks. |
This function returns False if the value is not a valid pathname to a PDF file, the pathname is null, the PDF file is not valid, or the PDF file is corrupted.
<cfscript>
a=[
"https://helpx.adobe.com/coldfusion/kb/coldfusion-2016-updates.html",
"https://helpx.adobe.com/captivate/using/whats-new.html"
]
after_last_slash=[];
for (i=1;i<=arraylen(a);i++){
//b[i]=a[i]
after_last_slash[i]=reMatch("([^\/]+$)",a[i]);
final_last_slash[i]=ArrayToList(after_last_slash[i]);
}
//writedump(final_last_slash)
for (i=1;i<=arrayLen(final_last_slash);i++){
before_dot[i]=reMatch(".*(?=\.)",final_last_slash[i]);
final_before_dot[i]=ArrayToList(before_dot[i]);
}
writeDump(final_before_dot);
// cfhtmltopdf
theDir=GetDirectoryFromPath(GetCurrentTemplatePath());
theFolder=theDir & "Assets"
a.map(function(value,item){
cfhtmltopdf(
destination="#theFolder#/#final_before_dot[item]#.pdf",
source="#value#",
orientation="portrait",
pagetype="A4",
margintop="1",
marginbottom="1",
marginleft="1",
marginright="1",
overwrite="true"
);
});
writeOutput(isPDFFile("#theFolder#/#final_before_dot[1]#.pdf"))
</cfscript>
Output
Sign in to your account