wkhtmltopdf "Unknown long argument --javascript-delay 2000"

  • I'm working with the wkhtmltopdf recipe. I have customized the wkhtmltopdf recipe to include a few extra parameters. When running in jsreportstudio the command issued is:

    C:\dev\sites\jsreport\node_modules\wkhtmltopdf-installer\vendor\wkhtmltopdf.exe --disable-local-file-access --javascript-delay 2000 --print-media-type --disable-smart-shrinking --dpi 600 --page-size Letter --margin-bottom 0 --margin-left 0 --margin-right 0 --margin-top 0 C:\Users\cknoll\AppData\Local\Temp\jsreport-temp\d387b310-13df-11e7-9508-571d864f50c9.html C:\Users\cknoll\AppData\Local\Temp\jsreport-temp\d387b310-13df-11e7-9508-571d864f50c9.pdf

    and I get the "Unknown long argument --javascript-delay 2000".

    If I run the same command from the command line in the C:\dev\sites\jsreport\node_modules\wkhtmltopdf-installer\vendor directory it works correctly.

    If I remove the "--javascript-delay 2000" it works correctly. Also the "--window-status" parameter errors in jsreportstudio but runs correctly from the command line. Any ideas on how to get it to run from jsreport studio?

  • administrators

    hmm difficult to tell you the problem with only that information, maybe first, you can try to send a PR to jsreport-wkhtmltopdf with your changes, if you are only adding more parameters, why don't send a PR and have support in the standard package?.

    i've found in other issues that javascript-delay was called redirect-delay before, maybe you can try with that option to see if it works.

  • I'll definitely submit a PR if I can get it to work :)

    The issue is that the command issued by jsreport studio errors while the exact same command works in a command window. I copy the command output from the jsreport studio output pane.

  • administrators

    hmm i think that windows need some escaping when passing arguments to childProcess.execFile, maybe you can try to escape each argument, you can see an example here

  • Thanks, that pointed me in the right direction. I changed this:

    params.push("--javascript-delay " + options.javascriptDelay );



  • administrators

    great!! don't forget to send us the PR when everything is working correctly.. we will be waiting 😀

  • Do you have an example of integrating into the jsreport studio UI? I'll add the following:


    and fix "Keep relative links"

  • administrators

    i guess that to you are doing your changes directly in the node_modules folder of your project, right? to change the visual part (studio) of jsreport-wkhtmltopdf you will need to clone the repository (https://github.com/jsreport/jsreport-wkhtmltopdf) and use npm start, that will launch the source in development mode, you can add more controls for the editor here, where you can find some examples too, you will need some React.js knowledge.

  • Cool, thanks. I don't know React but it looks straightforward.

  • Would you recommend cloning the repo into the node_modules folder? I'm not sure how jsreport would find it if it wasn't.

  • administrators

    you should clone the repo (make sure to fork jsreport-wkhtmltopdf and clone your fork not the main repo) in a new directory outside of your project, just treat it like a new project and move all your changes there and keep working over there.

  • Got it, thanks. I see in the docs that the extension pulls the studio in for testing.

  • administrators


Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.