Api send custom content with header for each page



  • Hi,

    I'm trying to do a request to api/report endoinpt and I want to create a report with custom content and with an header for eache page that have custom content too.

    For now I sent this:

    {
        "template": {
            "content": "hello world",
            "recipe": "chrome-pdf",
            "engine": "handlebars",
             "chrome":{
                "marginTop": "3cm"    
            },
             "pdfOperations": [
                {
                    "type": "merge",
                    "mergeWholeDocument": true,
                    "templateShortid": "-xuqFWrlI"
                }
            ]
        },
        "data": {},
        "options": { "reports": { "save": true } }
    }
    

    for now I have custom content on my page ("Hello world") and I want to send custom header but I can send only the template short id of an header. There is a way to send custom content also for the header?

    Thanks in advance.



  • There is, change templateShortid with template.

    "pdfOperations": [{
          "template": {
            "content": "Header",
            "recipe": "chrome-pdf",
            "engine": "handlebars"
          },
          "type": "merge",
          "mergeWholeDocument": true,
        }],
    


  • Thanks, it works


Log in to reply
 

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