node-html-pdf
node-html-pdf copied to clipboard
html-pdf: Unknown Error
html-pdf throw unknown error for bulk pdf convertion (above 200 html string).
same problem! any solution?
same here :(
same here. Any solution? Error: html-pdf: Unknown Error at ChildProcess.respond (/app/server/sds-platform/node_modules/html-pdf/lib/pdf.js:122:28) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
I'm having the same issue, any solution ?
I got same error when i tried to generate 3 PDF at same time, but i got solution. Just need to generate PDF one by one. I put code in async.waterfall with 3 functions. so PDF will generate one by one.
We had the same issue and the fix mentionned by bhedashakil worked for us.
Running tasks un series instead of parallel was it. We used Bluebird for promises, so it was an easy fix
Promise.map(convertJobs, job => {
into
Promise.mapSeries(convertJobs, job => {
@bhedashakil @savoiebz could you explain what you did to fix the issue? I can't seem to get it to function correctly
Personnaly, the issue I had got resolved when we stopped generating PDFs in parallel, instead we ran them in series. I think the lib was trying to spawn too many PhantomJS and was causing issues. If you aren't used to theses concepts: I suggest you read a bit on it. It is at the very core of NodeJS developpement. But basically, it is doing functions at the time vs one after the other one. If you know already all this, sorry to bother.
There is a handfull of library that allow you to handle asynchronous NodeJS events. If you program using Promises, I highly suggest using Bluebird. If you are still working with callbacks, you can use something like async(And maybe look into upgrading to promises someday 😊 ).
If it is not the kind of answer you were expecting, maybe you expand on your question or you could share a bit of code and I can try my best to have a look at it.
It is best to investigate about: Parallel, Serial, Waterfall and Queues for "general culture".
If is a bulk process you can make this way:
import pdf from 'pdf-creator-node'
...
for (const arrays of array) { // -> control the flow sequentially.
...
await pdf.create(document, options)
.then(res => {
console.log(res)
})
.catch(error => {
console.error(error)
})
...
}
...
This run the script of sequense way, will should not have problems.
hi, i am resolve with changes in my html content, check this https://github.com/marcbachmann/node-html-pdf/blob/master/examples/businesscard/businesscard.html
thanks ...
This doesn't use node, but here is a great video nevertheless! It converts HTML to PDF directly in HTML. This integrates both HTML + CSS + images into a PDF: https://www.youtube.com/watch?v=zmJV6VN2h2E . Hopefully this helps with your error
i got the same problem on production using heroku. The solution for me was creating a new env var OPENSSL_CONF with value /dev/null.
https://prnt.sc/VaOabzLAXFlO
i added to heroku env vars and it worked for me.
iam having same issue Please give me the solution...
@scush989898 's solution worked for me on Heroku! Thanks!
I found this answer and it worked for me in Stackoverfow