{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-pdf-export-template",
  "framework": "angular",
  "type": "registry:component",
  "component": "Grid",
  "variant": "pdf-export-template",
  "dependencies": [
    "@syncfusion/ej2-angular-grids"
  ],
  "description": "Data grid with a PDF export toolbar action and a query cell callback so templated columns export as plain text.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/angular/llms.txt",
    "skillPack": "syncfusion/angular-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/angular/grid-pdf-export-template.md"
  },
  "files": [
    {
      "target": "src/components/grid-pdf-export-template/grid.component.html",
      "content": "<div style=\"margin: 50px 90px\">\n  <ejs-grid #grid id='PdfExportTemplateGrid' [dataSource]='data' height='440' [rowHeight]='60' [allowPaging]='true' [pageSettings]='pageSettings'\n    gridLines='Horizontal' [allowPdfExport]='true' [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' (pdfQueryCellInfo)='pdfQueryCellInfo($event)'>\n    <e-columns>\n      <e-column field='OrderID' headerText='Order' width='110' isPrimaryKey='true'></e-column>\n      <e-column field='ShipName' headerText='Ship To' width='250'>\n        <ng-template #template let-data>\n          <div style=\"display:flex;align-items:center;gap:12px\">\n            <span [style.background]=\"color(data.CustomerID)\" style=\"width:36px;height:36px;border-radius:12px;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:13px\">{{ initials(data.ShipName) }}</span>\n            <div style=\"display:flex;flex-direction:column;justify-content:center\">\n              <span style=\"display:block;font-weight:600;color:#0f172a;line-height:20px\">{{ data.ShipName }}</span>\n              <span style=\"display:block;font-size:12px;color:#94a3b8;line-height:16px\">{{ data.CustomerID }}</span>\n            </div>\n          </div>\n        </ng-template>\n      </e-column>\n      <e-column field='ShipCity' headerText='City' width='150'></e-column>\n      <e-column headerText='Status' width='150'>\n        <ng-template #template let-data>\n          <span [style.background]=\"status(data).bg\" [style.color]=\"status(data).color\" style=\"border-radius:999px;padding:2px 10px;font-size:12px;font-weight:600\">{{ status(data).label }} · {{ days(data) }}d</span>\n        </ng-template>\n      </e-column>\n      <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column>\n    </e-columns>\n  </ejs-grid>\n</div>"
    },
    {
      "target": "src/components/grid-pdf-export-template/grid.component.ts",
      "content": "import { Component, ViewChild } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { GridModule, GridComponent, PageService, ToolbarService, PdfExportService } from '@syncfusion/ej2-angular-grids';\nimport { orderData } from '../datasource/grid-data';\n\n@Component({\n  selector: 'app-grid-pdf-export-template',\n  standalone: true,\n  imports: [CommonModule, GridModule],\n  providers: [PageService, ToolbarService, PdfExportService],\n  templateUrl: './grid.component.html'\n})\nexport class PdfExportTemplateComponent {\n  @ViewChild('grid') public grid?: GridComponent;\n  public data: Object[] = orderData;\n  public pageSettings = { pageSize: 8 };\n  public toolbar = ['PdfExport'];\n  private palette = ['#6366f1', '#0ea5e9', '#10b981', '#f59e0b', '#ec4899', '#8b5cf6'];\n\n  public color(text: string): string {\n    return this.palette[[...text].reduce((s, c) => s + c.charCodeAt(0), 0) % this.palette.length];\n  }\n  public initials(name: string): string {\n    return name.trim().split(/\\s+/).map(p => p[0]).slice(0, 2).join('').toUpperCase();\n  }\n  public days(o: any): number {\n    return Math.max(0, Math.round((new Date(o.ShippedDate).getTime() - new Date(o.OrderDate).getTime()) / 86400000));\n  }\n  public status(o: any): { label: string; color: string; bg: string } {\n    const d = this.days(o);\n    return d <= 5 ? { label: 'Fast', color: '#059669', bg: '#d1fae5' }\n      : d <= 10 ? { label: 'On time', color: '#0369a1', bg: '#e0f2fe' }\n      : { label: 'Delayed', color: '#b45309', bg: '#fef3c7' };\n  }\n\n  public toolbarClick(args: any): void {\n    if (args.item.id === 'PdfExportTemplateGrid_pdfexport') {\n      this.grid?.pdfExport({ fileName: 'Orders.pdf' });\n    }\n  }\n  // Templates are HTML-only, so give the PDF plain text for each templated column.\n  public pdfQueryCellInfo(args: any): void {\n    const d = args.data;\n    if (args.column.field === 'ShipName') args.value = `${d.ShipName} (${d.CustomerID})`;\n    if (args.column.headerText === 'Status') args.value = `${this.status(d).label} - ${this.days(d)} days`;\n  }\n}"
    }
  ]
}