Embed Assets (like CSS) into API call



  • I am attempting to move our JSreport Online data to our Github repo, and in doing so I want to move away from stored templates. How can I embed dependencies like assets into my API call? I am slowly replacing references with actual content (parameterized) like below:

    {
      "template": {
        "content": "{{templateContent}}",
        "recipe": "chrome-pdf",
        "engine": "handlebars",
        "chrome": {
          "printBackground": true,
          "marginTop": "2cm",
          "marginBottom": "2cm",
          "displayHeaderFooter": false,
          "mediaType": "print"
        }
      },
      "context": {
        "assets": [
          {
            "name": "template.css",
            "content": "{{cssContent}}"
          }
        ]
      },
      "data": "{{templateData}}",
      "pdfOperations": [
        {
          "type": "merge",
          "mergeWholeDocument": true,
          "templateShortid": "Ufj99EA",
          "enabled": true
        },
        {
          "type": "prepend",
          "templateShortid": "j66QyJa",
          "enabled": true
        },
        {
          "type": "merge",
          "mergeWholeDocument": true,
          "content": "{{footerContent}}",
          "enabled": true
        }
      ],
      "helpers": "{{helpersContent}}",
      "scripts": [],
      "pdfAccessibility": {
        "enabled": true
      }
    }
    


  • This isn't supported. The assets need to be stored in jsreport.
    You can replace strings in your template content before sending it to API.


Log in to reply
 

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