I generate some html text and then translate it to pdf using html-pdf package. Then I wanna put it into archive created by jsZip. In every example they use .toStream((err, stream) => stream.pipe(res))
but I cant find how to put it into archive.
I have tried zip.file('newPDF.pdf', pdf.create(html).toStream())
but it doesn't work
const createPDF = (html) => new Promise(((resolve, reject) => {
pdf.create(html).toStream((err, stream) => {
if (err) reject(err);
else resolve(stream);
});
}));
const PDF = await createPDF(html);
zip.file('newPDF.pdf', PDF);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.