I'm trying to create a PDF and push to user in a standalone node-webkit app. Generating PDF is ok but i'm not able to send it to user. I'have followed indication find here : http://pdfkit.org/demo/browser.html .
Here my controller :
paiApp.controller('pdfCtrl', function($scope) {
var PDFDocument = require('pdfkit');
var blobStream = require('blob-stream');
var doc = new PDFDocument;
stream = doc.pipe(blobStream());
doc.fontSize(15).text('Hello World');
doc.end();
stream.on('finish', function() {
iframe = document.getElementById('myIframe');
iframe.src = this.toBlobUrl(); //Error here
// blob = stream.toBlob('application/pdf') //Error ...
});
// Writting PDF is working
// ###################################
// var PDFDocument = require('pdfkit');
// var fs = require('fs');
// doc = new PDFDocument;
// doc.pipe(fs.createWriteStream('output.pdf'));
// doc.fontSize(15);
// doc.text('Generate PDF coool!');
// doc.end();
// #####################################
});
Here my error :
Object [object Object] has no method 'toBlobUrl'
Any idea ?