TJkrusinski/NodePDF

Error occurred when then html is "too big"

Opened this issue · 3 comments

I have a 2.1MB html. When I try to render the PDF, like this:

NodePDF.render(null, 'report.pdf', {
  'content': reportData,
  'viewportSize': {
    'width': 1440,
    'height': 900
  },
},function(err, filePath){
    console.log('err:' + err);
});

I got this error:

internal/child_process.js:298
    throw errnoException(err, 'spawn');
    ^

Error: spawn E2BIG
    at exports._errnoException (util.js:870:11)
    at ChildProcess.spawn (internal/child_process.js:298:11)
    at exports.spawn (child_process.js:362:9)
    at Object.exports.execFile (child_process.js:151:15)
    at Object.exports.exec (child_process.js:111:18)
    at Object.exports.exec (/report-project/node_modules/nodepdf/child.js:27:16)
    at /report-project/node_modules/nodepdf/index.js:133:20
    at /report-project/node_modules/nodepdf/child.js:38:12
    at ChildProcess.exithandler (child_process.js:204:7)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:818:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

did you got any solution. I have the same issue

With latest version I have got the issue. But I am able to get pdf with v1.2.0
npm install nodepdf@1.2.0

The only solution I found so far is to make smaller pdf