Generate pdf from docx template by unoconv always get timeout error.

  • Hi, we want generate pdf from docx template in js report. We find the unoconv extension can do it, so we install unoconv on our js report server, the preview will timeout sometimes. if I retry print, it will works good and print a pdf.
    Our website is send the docx template bytes[] and json data both from java script, then js report server return the pdf to website. But the js report server always return timeout error. We check the auto clean folder, the doxc file created success the pdf file also created but the content didn't all convert.
    We set the timeout in js report config, but it looks not work.

    "scripts": {
      "timeout": 600000,
      "strategy": "http-server"
    "sample-template": {
      "createSamples": true
    "chrome-pdf": {
        "timeout": 600000
    "unoconv": {
      "command": "python C:/jsreportapp/unoconv.js",
      "timeout": 600000000
    "templatingEngines": {
      "timeout": 6000000,
      "strategy": "http-server"

    Below is our send print request

        var printCommand = {
            "template": {
                "recipe": "docx",
                "engine": "handlebars",
                "docx": {
                    "templateAsset": {
                        "content": command.content, //word template bytes[]
                        "encoding": "base64"
                "unoconv": {
                    format: "pdf"
            "data": //json data

    Below is the timeout error:
    "Error: Timeout error during executing script
    at Timeout._onTimeout (C:\jsreportapp\node_modules\script-manager\lib\manager-servers.js:149:25)
    at ontimeout (timers.js:498:11)
    at Timer.unrefdHandle (timers.js:611:5)
    From previous event:
    at Reporter.executeScript (C:\jsreportapp\node_modules\jsreport-core\lib\reporter.js:360:47)
    at AsyncFunction.reporter.afterRenderListeners.add (C:\jsreportapp\node_modules\jsreport-unoconv\lib\unoconv.js:25:35)
    at C:\jsreportapp\node_modules\listener-collection\lib\listenerCollection.js:171:33
    at C:\jsreportapp\node_modules\listener-collection\lib\listenerCollection.js:151:16
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)"

  • Thank you for the question.

    How long does the conversion normally take in the preview? And after how long it times out when making API call?

    Note the templatingEngines node should be at the root level in the config and unoconv inside the extensions node.
    Since jsreport 2.7.0 it is also possible to use just single "timeout": 600000 at the config root for general timeout.

  • Thanks, I fix the timeout issue as your solution, move the templatingEngines node to root level and set a root level timeout value, then the preview and print will not timeout.

  • Great! Thank you for sharing the resolution.

Log in to reply

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