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); + })); } /**