I'm trying to convert my CFML code to CFScript, but I am getting an error with CFHtmlToPdf.
CFML:
<cfoutput>
<cfhtmltopdf orientation="portrait" pagetype="A4" margintop="1" marginbottom="1" name=pdfFile>
#arguments.data.HTMLData#
</cfhtmltopdf>
<cfmail type=HTML to="#arguments.data.Email#" from="[email protected]" subject="Form Test" server="localhost">
TEST
<cfmailparam file="#arguments.data.ReportName#.pdf" type="application/pdf" content="#pdfFile#"/>
</cfmail>
</cfoutput>
My cfscript code:
cfhtmltopdf(source=arguments.data.HTMLData, destination=pdfPath);
mailerService = new mail();
mailerService.setTo("arguments.data.Email");
mailerService.setFrom("[email protected]");
mailerService.setSubject("Form Test");
mailerService.setType("html");
mailerService.addParam(file="Test.pdf",type="application/pdf",content=pdfPath);
mailerService.send(body="Test");
I'm getting the error:
Either the src is not a proper URL or the file specified by absolute path does not exist.
The error occurs in the line:
cfhtmltopdf(source=arguments.data.HTMLData, destination=pdfPath);
Am I using CFHtmlToPdf incorrectly in cfscript?