我有一个项目,我必须向用户提供使用 pdfkit 生成的 pdf,并允许用户使用 blob 下载相同的文件。我这样做时出错了。任何帮助,将不胜感激。错误-
TypeError: Blob is not a function
at BlobStream.toBlob (C:\Users\ws\node_modules\blob-stream\index.js:33:18)
Code Snippet:
var doc = new report();
var blobStream = require('blob-stream');
var stream = doc.pipe(blobStream());
doc.text('And here is some wrapped text...', 100, 300)
.font('Times-Roman', 13)
.moveDown()
.text('lorem', {
width: 412,
align: 'justify',
indent: 30,
columns: 2,
height: 300,
ellipsis: true
});
doc.end();
stream.on('finish',function(){
blob = stream.toBlob('Blob/pdf');
});