Long reports return: Unable to render template. Timeout during evaluation of pdf-utils operations
-
Hello,
The full exception is:
jsreport.Client.JsReportException: 'Unable to render template. Timeout during evaluation of pdf-utils operations'
I seem to receive this any time I am rendering a report 30 pages or over. pdf-utils is setup to perform a merge of a page footer for each page.
Here is the config.json of my "master" template:
{ "folder": { "shortid": "ITA_ZvJ" }, "shortid": "B1lecBzF1B", "name": "sales-order", "recipe": "chrome-pdf", "engine": "handlebars", "chrome": { "printBackground": true, "displayHeaderFooter": false }, "creationDate": "2019-06-20T14:20:13.845Z", "modificationDate": { "$$date": 1561409017044 }, "_id": "BXlf7xpYCnmvS5l1", "$entitySet": "templates", "data": { "shortid": "BJeiXcfFJr" }, "pdfOperations": [ { "type": "merge", "templateShortid": "H1xcBlBK1B", "enabled": true, "renderForEveryPage": true, "mergeWholeDocument": false } ] }
And here is the config.json for the footer:
{ "folder": { "shortid": "ITA_ZvJ" }, "shortid": "H1xcBlBK1B", "name": "sales-order-footer", "recipe": "chrome-pdf", "engine": "handlebars", "chrome": { "printBackground": true }, "creationDate": "2019-06-20T17:20:28.090Z", "modificationDate": { "$$date": 1561124362090 }, "_id": "cb4JxG0tbxJe9e6E", "$entitySet": "templates" }
And the template of the footer:
<div style="position: absolute; bottom: 10px">Page {{$pdf.pageNumber}} of {{$pdf.pages.length}}</div>
I need to be able to generate reports that have many more than just 30 pages, potentially around 500. Is there a way to increase the timeout for pdf-utils?
Let me know if you need any more information like the main template contents (it is essentially an order receipt with product images).
Thanks in advance!
Mike
-
I need to be able to generate reports that have many more than just 30 pages, potentially around 500. Is there a way to increase the timeout for pdf-utils?
yes, you should be able to increase the timeout by using this in your
jsreport.config.json
file{ ... "templatingEngines": { "timeout": 40000 } ... }
which increases it to 40seconds. you can put there the value you want.
I seem to receive this any time I am rendering a report 30 pages or over. pdf-utils is setup to perform a merge of a page footer for each page.
I need to be able to generate reports that have many more than just 30 pages, potentially around 500have you tried to use the
merge whole documents
option? https://jsreport.net/learn/pdf-utils#mergeit should speed up the rendering a lot, because that instead of doing one render for each page it does one render and then just combine the pages. i think you should try it, it should increase the rendering speed a lot, here is an example https://playground.jsreport.net/w/admin/Wy6stA8t if you have some problems trying to layout things when using the
merge whole documents
option then remember that you can share the entities of your example on the playground or by uploading an export zip file here in the post
-
Thanks a lot I will try that in the future. I actually realized I can just use the native Chrome footer for this after reading https://forum.jsreport.net/topic/1116/jsreport-native-header-footer-issue (I wasn't seeing the footer because I didn't set the margin like the OP) so that solution is working for me, but I will check that out if I need a more advanced solution.