NodePDF icon indicating copy to clipboard operation
NodePDF copied to clipboard

render.js fails to start if `stdin.length` exceeds system's command length

Open chris--young opened this issue 11 years ago • 4 comments

Because Pdf arguments are eventually passed in to the phantomjs script as command line arguments, if their combined length is too long the command can exceed the system's maximum command length. When this happens render.js fails to execute, but this case is not checked so the call to Pdf hangs indefinitely. I ran in to this problem by setting opts.content to a large html string composed of embedded base64 images. You will find an example of the issue in the gist below. I have a fix that spawns off an instance of getconf and emits and error if the phantomjs command exceeds the system's limit but I think the ideal solution would be to stream Pdf arguments in to render.js through stdin after the script starts. That way there would not be a limit at all.

https://gist.github.com/chris--young/be26ebf352643df4773f

chris--young avatar Jun 06 '14 19:06 chris--young

You're right. I'll consider to fix this the next few days. Otherwise, pull requests are always welcome ;)

n3o77 avatar Jun 06 '14 20:06 n3o77

I will submit a pull request after testing.

chris--young avatar Jun 06 '14 21:06 chris--young

we would love to have a fix for this, as its impacting our app as well. Thank you

openpathgit avatar Jan 20 '15 15:01 openpathgit

This feature has always given users a bit of trouble, @openpathgit is serving the html too much of a problem that you need to send it in via the module?

TJkrusinski avatar Jan 20 '15 15:01 TJkrusinski