我试图在cfscript中使用cfdocument,但它返回Invalid CFML construct。在将代码更改为标记之前,我想知道是否可以在cfscript中使用cfdocument。
下面是我的例子:
cfdocument(name="Agreement", format="PDF", pagetype="custom", pageheight="5", pagewidth="6.5", margintop="0", marginbottom="0", marginright="0", marginleft="0){
cfdocumentSection(){ writeOutput(#local.Agreement#) }
}发布于 2018-09-29 19:45:01
是的,我们不能在coldfusion的cfscript中使用cfdocument。但我们可以在lucee中使用。
我已经添加了一个示例代码,
cfdocument(
format = "PDF"
filename = "test.pdf"
backgroundvisible = "yes"
fontembed = "yes"
marginbottom = "100"
marginleft = "100"
marginright = "100"
margintop = "100"
orientation = "100"
pagetype = "100"
pageheight = "100"
pagewidth = "100"
) {
cfdocumentitem( type = "header" ) {
//Header section
}
cfdocumentsection() {
// body section
}
cfdocumentitem( type = "footer" ) {
//footer section
}
}发布于 2021-11-23 17:09:54
需要澄清的是,上面的原始代码失败并不是因为CF中缺少对cfdocument as script的支持(至少在2014年的时候是这样),而是因为最后一个属性,CF11 last,缺少一个结束引号:marginleft="0。
当然,任何测试它的人都需要删除或更改正文中输出的变量,并且name参数阻止向浏览器生成CF11,而是将其保存在该名称的变量中。
https://stackoverflow.com/questions/50277270
复制相似问题