没有搞成功,
我是模仿使用手册的方法实现自动转换html为pdf附件。使用那一段固定html文本代码是可以成功创建附件的。想要做一个动态截取表单内容html转换pdf附件。没搞明白怎么得到那个html文本。代码入下,请管理员帮忙改一下;
[JavaScript] 纯文本查看 复制代码 var work = this.workContext.getWork();
//var html = '<style>table{border-collapse:collapse}td{border:1px solid rgb(3,3,3)}.title{font-weight:bold;height:30px;line-height:30px;width:22%;text-align:center}.content{width:30%;padding-left:10px}</style><table cellspacing="0"style="width: 700px; background-color: rgb(255, 255, 255);"><tr><td colspan="4"style="width: 100%;text-align: center;font-size: 24px; line-height: 60px; font-weight: bold; height: 60px; color: black;">教育系统国内公务考察活动审批表</td></tr><tr><td class="title">主题</td><td colspan="3"class="content">余杭小学外出考察学习审批</td></tr><tr><td class="title">经办人</td><td class="content">张安</td><td class="title">联系电话</td><td class="content">15858248111</td></tr></table>';
var data = this.data
var form = this.form
var node = this.form.get("table").node
var html = node.innerHTML
var action = this.Actions.load("x_processplatform_assemble_surface");
var fileName = work.title + '.pdf';
debugger
//html转换成pdf
action.AttachmentAction.htmlToPdf({
"workHtml" :html,
"title" : fileName
},function( json ){
//上传到附件
var url = "http://192.168.3.129/x_processplatform_assemble_surface/jaxrs/attachment/download/transfer/flag/" + json.data.id;
action.AttachmentAction.uploadWithUrl({
"workId" : work.id,
"fileName" : fileName,
"fileUrl" : url,
"site" : "attachment",
"person" : "xadmin"
},function(){})
}.bind(this)); |