Hi friend,
I am going to use http://pdfkit.org/demo/browser.html to generate pdf in iframe but it gives error
this._blob = new Blob(this._chunks, {
TypeError: undefined is not a function
at BlobStream.toBlob (/home/hacker201501/Desktop/cocreate/node_modules/blob-stream/index.js:33:18)
at BlobStream.
at BlobStream.EventEmitter.emit (events.js:129:20)
at finishMaybe (_stream_writable.js:446:14)
at endWritable (_stream_writable.js:455:3)
at BlobStream.Writable.end (_stream_writable.js:422:5)
at PDFDocument.onend (_stream_readable.js:501:10)
at PDFDocument.g (events.js:199:16)
at PDFDocument.EventEmitter.emit (events.js:129:20)
at _stream_readable.js:898:16
this is my code
stream.on('finish', function() {
var blob, url;
blob = stream.toBlob('application/pdf');
url = stream.toBlobURL('application/pdf');
console.log(url)
return iframe.src = url;
});
Any progress on this issue?
+1
Hello I got a similar error:
My code:
var pdfDoc = require("pdfkit");
var doc = new pdfDoc();
var blobStream = require("blob-stream");
var stream = doc.pipe(blobStream());
// some document stuff here e.g doc.text()
doc.end()
stream.on("finish",function(){
var blob = stream.toBlob("application/pdf");
// use blob here
});
This is the error Im getting:
this._blob = new Blob(this._chunks, {
^
TypeError: Blob is not a function
at BlobStream.toBlob (.../node_modules/blob-stream/index.js:33:18)
at BlobStream.<anonymous> (.../make-invoice.js:269:27)
at emitNone (events.js:72:20)
at BlobStream.emit (events.js:166:7)
at finishMaybe (_stream_writable.js:482:14)
at endWritable (_stream_writable.js:492:3)
at BlobStream.Writable.end (_stream_writable.js:457:5)
at PDFDocument.onend (_stream_readable.js:498:10)
at PDFDocument.g (events.js:260:16)
at emitNone (events.js:67:13)
@costas1379 or @nqgajanan did you find any solution for your problem?
Most helpful comment
@costas1379 or @nqgajanan did you find any solution for your problem?