Whatever message this page gives is out now! Go check it out!
IsPDFFile("path")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. |
<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>