NodePDF icon indicating copy to clipboard operation
NodePDF copied to clipboard

Error occurred when then html is "too big"

Open thermech opened this issue 8 years ago • 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)

thermech avatar May 31 '16 12:05 thermech

did you got any solution. I have the same issue

mouryaamit avatar Jun 08 '16 09:06 mouryaamit

With latest version I have got the issue. But I am able to get pdf with v1.2.0 npm install [email protected]

mouryaamit avatar Jun 08 '16 09:06 mouryaamit

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

thermech avatar Jun 08 '16 12:06 thermech