Sending a PDF created dynamically as an attachment using PDFKit in a nodejs application
问题 I am trying to create a pdf dynamically using PDFkit and want to send it as an attachment in a email. Following this http://pdfkit.org/demo/browser.html example and this https://nodemailer.com/using-attachments/ documentation I wrote the following code: var doc = new PDFDocument(); var stream = doc.pipe(blobStream()); doc.text("Howdy!!"); doc.on('end'); stream.on('finish', function() { var htmlMailBody ='Hi' var textMailBody = 'hi'; var mailOptions = { from: 'ASD', // sender address to: