AG Studio Launch Week 🚀🚀🚀 28 Sep - 2 Oct 2026 🚀🚀🚀 Join now




Core Features

Advanced Features

JavaScript Data GridPDF Export - Styles

Version 36.1.0
Enterprise

PDF Export uses colours from the active grid theme by default. Use colors to override page, body-row, alternate-row, header, text, and border colours for the exported document.

Automatic Grid Styles Copy Link

PDF Export can evaluate supported grid style definitions during serialisation:

  1. rowStyle and getRowStyle are applied to the exported row.
  2. colDef.cellStyle is applied to each exported body cell.
  3. colDef.headerStyle is applied to exported header cells.
  4. A cell style overrides the row style for properties supplied by both.

For function-based cellStyle, the value parameter is the grid's display value before PDF export callbacks process it. This allows existing grid styling logic to continue working when processCellCallback changes the exported text.

Only properties represented by PdfCellStyle are converted. CSS classes, cellClass, cellClassRules, arbitrary CSS, and Cell Renderer styles are not exported.

Set skipGridStyles=true to skip grid style definitions and use only theme defaults, colors, and PDF-specific overrides. This also skips colDef.wrapText and colDef.wrapHeaderText integration.

PDF-Specific Overrides Copy Link

Use processStyleCallback to style exported elements without changing the grid. The callback receives type: 'row' | 'cell' | 'rowgroup' | 'header' | 'groupheader' and the final exported text in value for cell and header elements.

Styles returned by processStyleCallback take precedence over automatic grid styles:

  1. A row result overrides rowStyle and getRowStyle for that row.
  2. A cell or rowgroup result overrides the resolved row style and colDef.cellStyle for that cell.
  3. A header or groupheader result overrides colDef.headerStyle for that header.

processStyleCallback still runs when skipGridStyles=true.

Text And Box Styles Copy Link

PdfCellStyle supports built-in PDF fonts, font size and weight, text and background colours, borders, padding, alignment, wrapping, explicit line-break preservation, line height, maximum lines, and overflow behaviour. Margin is supported for the document title only.

Use the top-level export parameters to configure document-wide typography and table boxes:

api.exportDataAsPdf({
    fontFamily: 'Times-Roman',
    headerFontFamily: 'Times-Bold',
    fontSize: 9,
    headerFontSize: 10,
    cellPadding: 4,
    drawCellBorders: true,
});