I need to pass the content held in variable reportData and the page orientation also as the template is used by different reports. The rest is over-specification but adds clarity.
I use a blank template (shortid:"HkLEC10iz") which calls the script to replace the '$$$' placeholder in a layout template (localCSS_layout.html). The footer is attached to the template and displays if run in Studio with sample data but not if called via render as above. Why is the footer not displaying?
C
Posts made by CRoantree
-
RE: Footers in PhantomPDF
-
Footers in PhantomPDF
I am using the template layout as described in your blog article https://jsreport.net/blog/template-layouts to pass HTML content. I get the footer with page numbers printed if I run the template in Studio with sample data but the footer does not print when using the following render call:
var reportRequest = { template:{ shortid:"HkLEC10iz", content: reportData, recipe:'phantom-pdf', engine:'handlebars', phantom: {orientation: '#pageorientation#'} }, data: { localStyling: '#mainSiteURL#css/#useStylesheet#.css', } };
The script is
function beforeRender(req, res, done) { var layout = '{#asset localCSS_layout.html @encoding=string}' req.template.content = layout.replace('$$$', req.template.content) done(); }
Hosting jsReport on remote Linux server, running as pm2 service, Phantomjs version 1.9.8. Expect script to run twice - once for template, once for footer - this happens in Studio but not from render call. Any ideas what could be wrong?