pdf - Trouble using PDFkit with Meteor -
i using pdfkit meteor , getting error
object has no method 'writesync'
can tell me package contains method? missing something?
my packages include:
meteorhacks:asyncmeteorhacks:npmnpm-containercfs:filesystemcfs:standard-packagespascoual:pdfkit
the documentation contains meteor add pascoual:pdfkit , suggests add 2 fibered methods writesync , outputsync, not found.
can help?
m using pdfkit in server side using 2 alternatives:
rounting: lib/router.js
router.route('/createpdf/:_paramid', function() { var paramid = this.params._paramid; if (!paramid) return;
var doc = new pdfdocument({ size: 'a4', margins: { top: 50, bottom: 0, left: 50, right: 50, } }); doc.image(process.env.pwd + '/public/sample1.jpg', 0, 30); this.response.writehead(200, { 'content-type': 'application/pdf', 'content-disposition': 'attachment; filename=somename.pdf' }); this.response.end(doc.outputsync());}, { where: 'server' });
and, calling client using:
router.go('/createpdf/' + someparamid); calling meteor method
meteor.call('createpdf', paramid);
and changing pdf building method
meteor.methods({ createpdf: function(paramid) { if (!paramid) return; var doc = new pdfdocument({ size: 'a4', margins: { top: 50, bottom: 0, left: 50, right: 50, } }); doc.image(process.env.pwd + '/public/img/sample1.jpg', 0, 30); .... doc.writesync(process.env.pwd + '/public//pdf/' + pdfname + '.pdf'); } }); i have 1 trouble, doesn't work in blabla.meteor.com test app, server cannot found images using doc.image(...)
Comments
Post a Comment