command line render questions


  • administrators

    no, you should put that value in the configuration file jsreport.config.json of your project



  • Hi,

    A couple more questions.

    • Can I specify both --template xxx.json and --template.recipe xyz to override just the recipe part of the configuration? It doesn't seem to work for me.
    • How do I specify wkhtmltopdf specific options, e.g. header, is it --template.wkhtmltopdf.header and then the HTML or can I somehow provide an HTML file for it?

    Thank you


  • administrators

    Can I specify both --template xxx.json and --template.recipe xyz to override just the recipe part of the configuration? It doesn't seem to work for me.

    no, unfortunately that is not going to work in current version, you will need to provide all the configuration in the json file.

    How do I specify wkhtmltopdf specific options, e.g. header, is it --template.wkhtmltopdf.header and then the HTML or can I somehow provide an HTML file for it?

    since --template.wkhtmltopdf.header is an option that it is part of external jsreport extension there is no built-in support for files in CLI, for now you will need to use the --template xxx.json and provide the options there. we will try to extend the support for CLI for external extensions options in the future.



  • So, is there any way to accommodate the following scenario: "I have a xxx.json file with all of the settings for the report but I'd like to generate both PDF and HTML via command line utilizing the wkhtmltopdf for PDF generation"?
    I guess one option would be to have xxx.json prepared with wkhtmltopdf options for PDF generation via render and --template xxx.json and then use --template.content xxx.handlebar --template.recipe html to generate HTML. The concern I have is what will happen to the scripts in this case? I don's see how those can be provided to the render other than using the report's json file.


  • administrators

    So, is there any way to accommodate the following scenario: "I have a xxx.json file with all of the settings for the report but I'd like to generate both PDF and HTML via command line utilizing the wkhtmltopdf for PDF generation"?

    for now you will need to have a .json per request that uses different recipe.

    The concern I have is what will happen to the scripts in this case? I don's see how those can be provided to the render other than using the report's json file.

    about the scripts you will need to use the json file too, since you will need to define the scripts, those values are complex enough to not express them in command arguments easily so we have not built support for them because it is something we still need to think about.

    i see that you are trying to use the render command to define everything for a report in there, we did not expect users to use the command in this way because there are complex values that are really hard to support from command arguments so the workaround for that is to use the .json file.

    the most common way that we expect users to use the render command is with stored templates, scripts, etc. for example if you create a template with html recipe + scripts, save it, get its shortid, then you can use this to render it. jsreport render --template.shortid xxxxx, then when you need to use other recipe you can use jsreport render --template.shortid xxxxx --template.recipe custom-recipe-here, in this case you don't need to worry about passing scripts in command arguments, because those are already defined in the stored template.



  • Thank you!



  • I have a question on performance when it comes to the render command.
    What would be the best settings for render in a cloud environment?
    For example keepAlive keeps jsreport as a daemon process which speeds up single render call but at the same time it seems that multiple executions of render would compete for a single process. Or maybe I'm mistaking and the number of actual rendering (sub?) processes is controlled by the tasks.numberOfWorkers?
    Sorry for this kind of questions, but it is a bit unclear as far as the configuration goes when it comes to the command line stuff.


  • administrators

    What would be the best settings for render in a cloud environment?
    For example keepAlive keeps jsreport as a daemon process which speeds up single render call but at the same time it seems that multiple executions of render would compete for a single process. Or maybe I'm mistaking and the number of actual rendering (sub?) processes is controlled by the tasks.numberOfWorkers?
    Sorry for this kind of questions, but it is a bit unclear as far as the configuration goes when it comes to the command line stuff.

    the best is to use keepAlive, what keepAlive do is to start the jsreport server in its own standalone process with the configuration that you have in your project, that process already balance executions in the workers you have defined in tasks.numberOfWorkers, the render command then just communicate with this process to send execution requests, so there is no bottleneck in render command when using keepAlive



  • Thank you, by the way, hat is the default for the numberOfWorkers, should I generally leave it unchanged?


  • administrators

    it defaults to just one, so you should change it to be able to handle more parallel requests. i see this is not mentioned in configuration docs, i will add a reminder to myself to add this to docs, thanks.



  • Awesome! Thank you!


Log in to reply
 

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