使用ongoworks:pdf软件包在客户端保存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…:2218 2218contentAsFunc@ blaze.js?hash=38069f4…:2261Blaze.toHTMLWithData @ blaze.js?hash=38069f4…:2380Blaze.outputAsPDF @ ongoworks_pdf.js?hash=245293c…:9442Blaze.saveAsPDF @ ongoworks_pdf.js?hash=245293c…:9461clickButton_export
发布于 2016-06-12 13:28:19
据我所知,您从meteor-pdf的示例中复制了这段代码。您的模板名为report吗?否则Template.report是一个不存在的值(undefined)。
另外,content变量应该包含一个对象(key=>value对),它将被输入到指定的模板(report)中,而不是HTML。
https://stackoverflow.com/questions/37773768
复制相似问题