使用ongoworks:pdf Meteor包将pdf文件保存在客户端上。
功能:
"click #button_export": function(ev, template) {
var content = document.getElementById("printData").innerHTML;
Blaze.saveAsPDF(Template.report, {
filename: bomId + ".pdf",
data: content,
x: 0,
y: 0,
orientation: "landscape",
unit: "in",
format: "letter"
});
},
错误:
blaze.js?hash = 38069f4 ...:2218未捕捉错误:无法渲染 undefinedcheckRenderContent @ blaze.js?hash = 38069f4 ...:2218contentAsFunc @ blaze.js?hash = 38069f4 ...:2261Blaze.toHTMLWithData @ blaze.js?hash = 38069f4 ...:2380Blaze.outputAsPDF @ ongoworks_pdf.js?hash = 245293c ...:9442Blaze.saveAsPDF @ ongoworks_pdf.js散列= 245293c ...:9461clickButton_export
答案 0 :(得分:0)
据我所知,你从meteor-pdf
的例子中复制了这段代码。您的模板名为report
吗?否则Template.report
是不存在的值(undefined
)。
此外,content
变量应包含要输入指定模板(report
)而不是HTML字符串的对象(key =>值对)。