Document TemplateMixing Fields And Text

There are 'template' and 'htmltemplate' properties for when mixing static content and data fields.

Sample Data

{
    "static": [
        {
            "firstname": "John",
            "lastname": "Public"
        },
        {
            "firstname": "Fred",
            "lastname": "Flintstone"
        }
    ]
}

Simple Template

This template generates text that merges field values in to the text.

This example just merges data, it doesn't change the formatting within the text.

Note the 'startnew' property set to 'Page' indicates that this content should always start on a new page.

{
    "startnew": "Page",
    "template": [
        "Hello ",
        {
            "field": "firstname"
        },
        " "
        ,
        {
            "field": "lastname"
        },
        "\n",
        "This is a reminder of your upcoming appointment."        
    ]
}

Simple HTML Template

This template generates html that merges field values in html content.

Being HTML, font styling, justification can be changed within the template, Here we bold the name, and italicize the word 'appointment'.

{
    "startnew": "Page",
    "htmltemplate": [
        "Hello <b>",
        {
            "field": "firstname"
        },
        " ",
        {
            "field": "lastname"
        },
        "</b><br/>",
        "This is a reminder of your upcoming <i>appointment</i>."
    ]
}

Complex Content

This template complex content using a 'content' array, it is not as terse as 'htmltemplate', but gives you much finer control since you can include document tables, images pagination and section directives.

{
    "startnew": "Page",
    "content" :[
        {
            "text": "Hello "
        },
        {
            "textformat": {
                "bold": true,
                "color": "Red"
            },
            "field": "firstname"            
        },
        {
            "text": " "
        }
        ,
        {
            "textformat": {
                "bold": true,
                "color": "Red"
            },
            "field": "lastname"
        },
        {
            "text": "\nThis is a reminder of your upcoming appointment."
        }
        
    ]
}