I need to make a PDF file put of rendered with data html Blaze Template.
I need it to support utf-8, because im using some hebrew charcters, so most of the packages I tried doesn't fit the job.
I tried using jsPDF and addHTML libraries with jspdf:core package, and I added html2canvas.js file to my compatibility folder on the client folder (at the demo I paste the file to common.js).
Meteor Pad as demo : http://meteorpad.com/pad/g5GBn8TRrNHxYJ9ip/Leaderboard%20to%20html
My problem is that the callback function of addHTML is never executed (line 20 on client/app.js at the demo):
var html = Blaze.toHTMLWithData(Template.filledform, {'text' : 'יום אחד, בא אלי בחור ואמר לי:'}),
pdf = new jsPDF('p','pt','a4'),
options = {
proxy: Meteor.absoluteUrl()
},
pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML(html, options, function() {
console.log("callBack");
return pdf.output('datauri');
});
I also tried:
var href = '',
html = Blaze.toHTMLWithData(Template.filledform, {'text' : 'יום אחד, בא אלי בחור ואמר לי:'}),
pdf = new jsPDF('p','pt','a4'),
options = {
proxy: Meteor.absoluteUrl()
};
pdf.addHTML(html, options, function() {
return href = pdf.output('datauristring');
}).then(function(a) {
console.log(a);
console.log(href);
return location.href = href;
});
but the href value never changed.