Reputation: 55
I would like, in my NodeJS app, to generate a PDF in server-side with pdfmake but i don't know how to do. I would like to don't save it on my server.
I have this
const printer = new PdfPrinter( fonts );
const pdfKitDoc = printer.createPdfKitDocument( dd );
const stream = pdfKitDoc.pipe( ... );
pdfKitDoc.end();
return stream;
and I don't know what I have to type instead of '...'. If it's possible, I would like to stream it as blob to use it in my apps.
Can anyone help me ?
Thanks
Upvotes: 1
Views: 2051
Reputation: 55
I solved my problem thanks to @Thee Sritabtim.
return toArray( doc ).then( parts => {
return Buffer.concat( parts );
} );
Upvotes: 1