From 103143347de16fded1892238f6efe6b01c770e97 Mon Sep 17 00:00:00 2001 From: Denis Voloshin Date: Tue, 26 May 2020 19:01:09 +0300 Subject: [PATCH] PDF toBuffer fix --- src/classes/generator.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/classes/generator.js b/src/classes/generator.js index 586e1bf..e0d41e2 100644 --- a/src/classes/generator.js +++ b/src/classes/generator.js @@ -507,10 +507,10 @@ export default class Generator extends Common { * @private */ _toBufferFromPDF(content) { - return content.toBuffer((err, buffer) => { - if (err) throw new Error(err); - return buffer; - }); + return new Promise((resolve, reject) => content.toBuffer((err, buffer) => { + if (err) return reject(err); + return resolve(buffer); + })); } /**