Closed vinithios closed 7 years ago
phantom's waitForJS
option is a template level option, if you are sending your template content with json, you need to set that option in your template property.
change this:
template: {
content: fs.readFileSync(path.join(rootPath, "public/views/chart.html"), 'utf8'),
recipe: 'phantom-pdf',
engine: 'handlebars'
}
to this:
template: {
content: fs.readFileSync(path.join(rootPath, "public/views/chart.html"), 'utf8'),
recipe: 'phantom-pdf',
engine: 'handlebars',
phantom: {
// template level options for phantomjs
"waitForJS": true
}
}
Thanks for your reply. After i changed my code, i am getting the below error,
{"message":"Error during rendering report: Timeout when executing in phantom","stack":"Error: Timeout when executing in phantom\n at Timeout._onTimeout (/home/ionixx/jsReports/node_modules/phantom-html-to-pdf/lib/dedicatedProcessStrategy.js:81:26)\n at ontimeout (timers.js:488:11)\n at Timer.unrefdHandle (timers.js:599:5)"}
I just set the phantom's timeout property as 1000
Code: "phantom": { "strategy": "dedicated-process", "timeout": 1000 }, "tasks": { "strategy": "dedicated-process", "timeout": 1000000, "allowedModules": "" }, "scripts": { "allowedModules": "", "timeout": 1000000 },
Is there any fix for this issue??
Last issue was fixed..I made silly mistake at javascript.(parenthesis not properly closed).After i make it close, the issue has been resolved. Thanks @bjrmatos, for your quick response.
I am getting empty pdf page while using jsreport. Below is my code which am i using in my client side,
Server side code: router.get('/', function(req, res, next){ var data = { template: { content: fs.readFileSync(path.join(rootPath, "public/views/chart.html"), 'utf8'), recipe: 'phantom-pdf', engine: 'handlebars' }, data: { country: "Brazil",
});
I configured jsreport config file as below, "phantom": { "strategy": "dedicated-process", "timeout": 180000, "waitForJS": true }, "tasks": { "strategy": "dedicated-process", "timeout": 1000000, "allowedModules": "" }, "scripts": { "allowedModules": "", "timeout": 1000000 },
But , i am getting empty pdf.Can anyone help me to solve this issue??