pdf.templateString(default: null)

A piece of HTML to be included in each page. Can be used to display headers and footers. See the documentation in drawDOM.

Available template variables include:

  • pageNum
  • totalPages

Important

Using a template requires setting paper size

Example - add header template to PDF export

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "productName" },
    { field: "category" }
  ],
  dataSource: [
    { productName: "Tea", category: "Beverages" },
    { productName: "Coffee", category: "Beverages" }
  ],
  toolbar: ["pdf"],
  pdf: {
    paperSize: "A4",
    template: ({ pageNum, totalPages }) => `<div class="page-template">
      <h2>Product Catalog - Page ${kendo.htmlEncode(pageNum)} of ${kendo.htmlEncode(totalPages)}</h2>
      </div>`,
    fileName: "Products.pdf"
  }
});
</script>
In this article
pdf.template
Not finding the help you need?
Contact Support