Chris C
Chris C

Reputation: 11

blaze.js Uncaught Error: Can't render undefined

Using ongoworks:pdf Meteor package to save pdf file on client.

The function:

"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"
    });
},

Error:

blaze.js?hash=38069f4…:2218 Uncaught Error: Can't render 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?hash=245293c…:9461clickButton_export

Upvotes: 0

Views: 520

Answers (1)

thoaionline
thoaionline

Reputation: 524

I understand that you copied this piece of code from meteor-pdf's example. Was your template named report? Otherwise Template.report is an non-existent value (undefined).

Also, the content variable should contains an object (key=>value pairs) to be fed into the specified template (report) instead of the HTML string.

Upvotes: 0

Related Questions