Document TemplatePage Layout

Image field types are supported by using the "imagefield" property.

Sample Data

First five records from Northwinds Customer Table.

{
    "static": [
        {
            "CustomerID": "ALFKI",
            "CompanyName": "Alfreds Futterkiste",
            "ContactName": "Maria Anders",
            "ContactTitle": "Sales Representative",
            "Address": "Obere Str. 57",
            "City": "Berlin",
            "Region": null,
            "PostalCode": "12209",
            "Country": "Germany",
            "Phone": "030-0074321",
            "Fax": "030-0076545"
        },
        {
            "CustomerID": "ANATR",
            "CompanyName": "Ana Trujillo Emparedados y helados",
            "ContactName": "Ana Trujillo",
            "ContactTitle": "Owner",
            "Address": "Avda. de la Constitución 2222",
            "City": "México D.F.",
            "Region": null,
            "PostalCode": "05021",
            "Country": "Mexico",
            "Phone": "(5) 555-4729",
            "Fax": "(5) 555-3745"
        },
        {
            "CustomerID": "ANTON",
            "CompanyName": "Antonio Moreno Taquería",
            "ContactName": "Antonio Moreno",
            "ContactTitle": "Owner",
            "Address": "Mataderos  2312",
            "City": "México D.F.",
            "Region": null,
            "PostalCode": "05023",
            "Country": "Mexico",
            "Phone": "(5) 555-3932",
            "Fax": null
        },
        {
            "CustomerID": "AROUT",
            "CompanyName": "Around the Horn",
            "ContactName": "Thomas Hardy",
            "ContactTitle": "Sales Representative",
            "Address": "120 Hanover Sq.",
            "City": "London",
            "Region": null,
            "PostalCode": "WA1 1DP",
            "Country": "UK",
            "Phone": "(171) 555-7788",
            "Fax": "(171) 555-6750"
        },
        {
            "CustomerID": "BERGS",
            "CompanyName": "Berglunds snabbköp",
            "ContactName": "Christina Berglund",
            "ContactTitle": "Order Administrator",
            "Address": "Berguvsvägen  8",
            "City": "Luleå",
            "Region": null,
            "PostalCode": "S-958 22",
            "Country": "Sweden",
            "Phone": "0921-12 34 65",
            "Fax": "0921-12 34 67"
        }
    ]
}

Document Template

{
    "info": {
        "width": "14in",
        "height": "8.5in",
        "margintop": "1.5in"
    },
    "table": {
        "area": {
            "border": {
                "style": "Single"
            }
        },
        "columns": [
            "70pt",
            "100pt",
            "100pt",
            "100pt",
            "100pt",
            "100pt",
            "70pt",
            "70pt",
            "80pt",
            "80pt",
            "80pt"
        ],
        "body": {
            "sections": [
                {
                    "name": "*root",
                    "source": "*root",
                    "sections": [
                        {
                            "source": "*header",
                            "rows": [
                                {
                                    "textformat": {
                                        "color": "White"
                                    },
                                    "area": {
                                        "fill": {
                                            "color": "Black"
                                        }
                                    },
                                    "cells": [
                                        {
                                            "text": "Customer ID"
                                        },
                                        {
                                            "text": "Company Name"
                                        },
                                        {
                                            "text": "Contact Name"
                                        },
                                        {
                                            "text": "Contact Title"
                                        },
                                        {
                                            "text": "Address"
                                        },
                                        {
                                            "text": "City"
                                        },
                                        {
                                            "text": "Region"
                                        },
                                        {
                                            "text": "PostalCode"
                                        },
                                        {
                                            "text": "Country"
                                        },
                                        {
                                            "text": "Phone"
                                        },
                                        {
                                            "text": "Fax"
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "rows": [
                                {
                                    "cells": [
                                        {
                                            "field": "CustomerID"
                                        },
                                        {
                                            "field": "CompanyName"
                                        },
                                        {
                                            "field": "ContactName"
                                        },
                                        {
                                            "field": "ContactTitle"
                                        },
                                        {
                                            "field": "Address"
                                        },
                                        {
                                            "field": "City"
                                        },
                                        {
                                            "field": "Region"
                                        },
                                        {
                                            "field": "PostalCode"
                                        },
                                        {
                                            "field": "Country"
                                        },
                                        {
                                            "field": "Phone"
                                        },
                                        {
                                            "field": "Fax"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}

The "info" object in the document allows document level properties to be set, this includes document metadata, but also page layout information.

This document sets the page size to be landscape orientation legal 14 inches wide and 8.5 inches high. The margins can be overridden as well, here we override the top margin to 1.5 inches.

images/pageLayout.PNG
PDF Custom Page Layout