首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我可以在cfscript中使用cfdocument吗?

我可以在cfscript中使用cfdocument吗?
EN

Stack Overflow用户
提问于 2018-05-11 00:18:15
回答 2查看 669关注 0票数 1

我试图在cfscript中使用cfdocument,但它返回Invalid CFML construct。在将代码更改为标记之前,我想知道是否可以在cfscript中使用cfdocument。

下面是我的例子:

代码语言:javascript
复制
cfdocument(name="Agreement", format="PDF", pagetype="custom", pageheight="5", pagewidth="6.5", margintop="0", marginbottom="0", marginright="0", marginleft="0){
                cfdocumentSection(){ writeOutput(#local.Agreement#) }
            }
EN

回答 2

Stack Overflow用户

发布于 2018-09-29 19:45:01

是的,我们不能在coldfusion的cfscript中使用cfdocument。但我们可以在lucee中使用。

我已经添加了一个示例代码,

代码语言:javascript
复制
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
    }
}
票数 0
EN

Stack Overflow用户

发布于 2021-11-23 17:09:54

需要澄清的是,上面的原始代码失败并不是因为CF中缺少对cfdocument as script的支持(至少在2014年的时候是这样),而是因为最后一个属性,CF11 last,缺少一个结束引号:marginleft="0

当然,任何测试它的人都需要删除或更改正文中输出的变量,并且name参数阻止向浏览器生成CF11,而是将其保存在该名称的变量中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50277270

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档