How to use the pdf utils?



  • I want use the pdf utils pass value to Header or Footer. I added the tag <div> {{{pdfAddPageItem :ClientName}}}</div> to my main template, but I got an errors as below:

    Error: Error while executing templating engine. Syntax error
    Unmatched or missing {{/pdfAddPageItem}}, in template:
    ...
    at C:\jsreportapp\node_modules\jsrender\jsrender-node.js:223:27
        at Object.<anonymous> (C:\jsreportapp\node_modules\jsrender\jsrender-node.js:2879:2)
        at Module._compile (module.js:653:30)
        at Object.Module._extensions..js (module.js:664:10)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
        at Function.Module._load (module.js:498:3)
        at Module.require (module.js:597:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (C:\jsreportapp\node_modules\jsreport-jsrender\lib\jsrenderEngine.js:6:16)
    From previous event:
        at executeScript (C:\jsreportapp\node_modules\jsreport-core\lib\util\executeScript.js:41:49)
        at Reporter.executeScript (C:\jsreportapp\node_modules\jsreport-core\lib\reporter.js:343:12)
        at invokeRender (C:\jsreportapp\node_modules\jsreport-core\lib\render\render.js:60:36)
        at module.exports (C:\jsreportapp\node_modules\jsreport-core\lib\render\render.js:150:11)
        at <anonymous>
    

    below was my studio version information:

    about
    
    version: 2.11.0
    
    Release notes
    
    engines:
    handlebars, jsrender, none
    
    recipes:
    chrome-image, chrome-pdf, docx, html, html-to-xlsx, html-with-browser-client, pptx, static-pdf, text, xlsx
    
    assets: 1.7.0
    authentication: 2.6.1
    authorization: 2.4.0
    base: 2.0.2
    browser-client: 2.2.2
    child-templates: 1.4.0
    chrome-pdf: 1.10.0
    cli: 2.2.5
    data: 2.4.0
    debug: 2.1.3
    docx: 2.9.0
    express: 2.8.1
    freeze: 2.0.0
    fs-store: 2.9.1
    handlebars: 2.1.0
    html-to-xlsx: 2.8.3
    import-export: 2.1.1
    jsrender: 2.1.1
    licensing: 2.2.3
    pdf-utils: 1.11.0
    pptx: 0.7.0
    public-templates: 2.2.0
    reports: 2.5.1
    resources: 2.1.0
    sample-template: 2.6.1
    scheduling: 2.5.0
    scripts: 2.6.0
    static-pdf: 0.4.0
    studio: 2.10.1
    studio-theme-dark: 0.3.0
    tags: 2.5.0
    templates: 2.4.0
    text: 2.0.0
    unoconv: 0.3.0
    version-control: 1.6.0
    xlsx: 2.5.0
    

    How to fix the errors?



  • This isn't valid jsrender syntax. {{{pdfAddPageItem :ClientName}}}.
    We have couple of jsrender examples in our docs
    https://jsreport.net/learn/pdf-utils

    Particularly this one should help
    https://playground.jsreport.net/w/admin/LHIiC3D8

    {{:~pdfAddPageItem(1)}}
    

    Or switch to handlebars which is a bit covered in the demos and exmaples.



  • @jan_blaha can you let me know how can I pass a value?
    Instead of just passing a number here?


Log in to reply
 

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