Core Features

Advanced Features

JavaScript Data GridPDF Export API Reference

Version 36.2.0
Enterprise

This page documents the PDF Export API and interfaces.

Grid Properties Copy Link

defaultPdfExportParamsCopy Link
A default configuration object used to export to PDF.
suppressPdfExportCopy Link
boolean
default: false
Prevents the user from exporting the grid to PDF.

API Methods Copy Link

exportDataAsPdfCopy Link
Function
Downloads a PDF export of the grid's data.
getDataAsPdfCopy Link
Function
Similar to exportDataAsPdf, except instead of downloading a file, it will return a Blob to be processed by the user.

Interfaces Copy Link

PdfCell Copy Link

Properties available on the PdfCell interface.

data requiredCopy Link
PdfCellData
The data that will be added to the cell.
mergeAcrossCopy Link
number
default: 0
The number of cells to span across (1 means span 2 columns).
PdfCellStyle
Optional styling for the cell.

PdfCellData Copy Link

Properties available on the PdfCellData interface.

value requiredCopy Link
string | null
The value of the cell.
string
External URI opened when the exported cell text is selected.
PdfImage
Image rendered alongside the cell value.

PdfCellHyperlinkCallbackParams Copy Link

Properties available on the PdfCellHyperlinkCallbackParams<TData = any, TContext = any> interface.

string
The final text exported for the cell.
accumulatedRowIndexCopy Link
number
The 1-based index of the current exported row.
The row node for the exported cell.
The current column.
The grid api.
Application context as set on gridOptions.context.

PdfCellStyle Copy Link

Properties available on the PdfCellStyle interface.

backgroundColorCopy Link
string
Background colour.
borderColorCopy Link
string
Border colour.
borderWidthCopy Link
number
Border width in points. Defaults to 1 when borderColor is set, otherwise 0.
paddingCopy Link
number | PdfMargin
Padding inside the cell in points. A number applies to all sides.
alignmentCopy Link
PdfTextAlignment
Horizontal alignment for the cell text.
wrapTextCopy Link
boolean
default: false
Whether text should wrap onto multiple lines. Wrapped content increases the row height as required.
preserveLineBreaksCopy Link
boolean
default: true when wrapText is true, otherwise false
Whether explicit line breaks should be preserved.
preserveSpacesCopy Link
boolean
default: false
Whether repeated, leading and trailing spaces should be preserved when text wraps.
maxLinesCopy Link
number
Maximum number of rendered text lines.
overflowCopy Link
PdfTextOverflow
default: 'ellipsis'
How text exceeding the available width, height or line limit is indicated.
fontSizeCopy Link
number
Font size in points.
fontFamilyCopy Link
PdfFontFamily
Font family.
fontWeightCopy Link
PdfFontWeight
Font weight. When omitted, the weight from the resolved font family is preserved.
fontStyleCopy Link
PdfFontStyle
default: 'normal'
Font style.
directionCopy Link
PdfTextDirection
Text direction. auto uses the first strong directional character. When omitted, the export-level direction is used. Text direction does not change exported column order.
languageCopy Link
string
BCP 47 language tag used when selecting language-specific OpenType features. When omitted, the export-level language is used.
string
Text colour.
lineHeightCopy Link
number
Distance between text baselines in points. Defaults to the natural line height from the resolved font metrics, with a minimum of fontSize.

PdfCellStyleCallbackParams Copy Link

Properties available on the PdfCellStyleCallbackParams<TData = any, TContext = any> interface.

'cell' | 'rowgroup'
The exported element type currently being styled.
The row node for the exported cell.
The current column.
accumulatedRowIndexCopy Link
number
1-based index of the current exported row.
any
The current value for the exported element.
The grid api.
Application context as set on gridOptions.context.

PdfColors Copy Link

Properties available on the PdfColors interface.

backgroundColorCopy Link
string
default: theme backgroundColor
Background colour for the PDF page.
dataBackgroundColorCopy Link
string
default: theme dataBackgroundColor
Background colour for body rows.
oddRowBackgroundColorCopy Link
string
default: theme oddRowBackgroundColor
Alternate background colour for odd body rows.
foregroundColorCopy Link
string
default: theme foregroundColor
Text colour for body rows.
headerBackgroundColorCopy Link
string
default: theme headerBackgroundColor
Background colour for header rows.
headerTextColorCopy Link
string
default: theme headerTextColor
Text colour for header rows.
borderColorCopy Link
string
default: theme borderColor
Border colour for cell outlines.

PdfDocumentHeadingStyle Copy Link

Properties available on the PdfDocumentHeadingStyle interface.

marginCopy Link
number | PdfMargin
Margin around the document heading in points. A number applies to all sides.
backgroundColorCopy Link
string
Background colour.
borderColorCopy Link
string
Border colour.
borderWidthCopy Link
number
Border width in points. Defaults to 1 when borderColor is set, otherwise 0.
paddingCopy Link
number | PdfMargin
Padding inside the cell in points. A number applies to all sides.
alignmentCopy Link
PdfTextAlignment
Horizontal alignment for the cell text.
wrapTextCopy Link
boolean
default: false
Whether text should wrap onto multiple lines. Wrapped content increases the row height as required.
preserveLineBreaksCopy Link
boolean
default: true when wrapText is true, otherwise false
Whether explicit line breaks should be preserved.
preserveSpacesCopy Link
boolean
default: false
Whether repeated, leading and trailing spaces should be preserved when text wraps.
maxLinesCopy Link
number
Maximum number of rendered text lines.
overflowCopy Link
PdfTextOverflow
default: 'ellipsis'
How text exceeding the available width, height or line limit is indicated.
fontSizeCopy Link
number
Font size in points.
fontFamilyCopy Link
PdfFontFamily
Font family.
fontWeightCopy Link
PdfFontWeight
Font weight. When omitted, the weight from the resolved font family is preserved.
fontStyleCopy Link
PdfFontStyle
default: 'normal'
Font style.
directionCopy Link
PdfTextDirection
Text direction. auto uses the first strong directional character. When omitted, the export-level direction is used. Text direction does not change exported column order.
languageCopy Link
string
BCP 47 language tag used when selecting language-specific OpenType features. When omitted, the export-level language is used.
string
Text colour.
lineHeightCopy Link
number
Distance between text baselines in points. Defaults to the natural line height from the resolved font metrics, with a minimum of fontSize.

PdfExportParams Copy Link

Properties available on the PdfExportParams interface.

PdfFontFamilyDefinition[]
default: []
Custom static TrueType font families available to this export. Font data must be loaded by the application before export.
languageCopy Link
string
BCP 47 language tag used for text shaping and PDF accessibility metadata. This can be overridden by individual cell styles.
directionCopy Link
PdfTextDirection
default: grid enableRtl setting
Default text direction for the PDF document. When omitted, this inherits the grid's enableRtl setting. Individual PdfCellStyle.direction values take precedence for text. An export-level value of rtl also renders table columns in right-to-left order.
documentTitleCopy Link
string
The document title stored in the PDF metadata. When set, a visible title is rendered above the exported table.
documentTitleStyleCopy Link
PdfDocumentHeadingStyle
Styling for the visible document title.
documentSubtitleCopy Link
string
A visible subtitle rendered below the document title.
documentSubtitleStyleCopy Link
PdfDocumentHeadingStyle
Styling for the visible document subtitle.
coverPageCopy Link
boolean
default: false
Set to true to render the document title and subtitle on a separate first page. The exported grid begins on the following page.
headerFooterConfigCopy Link
PdfHeaderFooterConfig
Page header and footer content.
watermarkCopy Link
PdfWatermark
A text watermark rendered across the content of selected pages.
colorsCopy Link
PdfColors
Override PDF colours. Any missing values fall back to the current theme.
skipGridStylesCopy Link
boolean
default: false
Set to true to skip applying grid style definitions and callbacks (rowStyle, getRowStyle, colDef.cellStyle, colDef.headerStyle). Use this when you want to rely only on colors and theme defaults.
processStyleCallbackCopy Link
Function
Callback that allows overriding styles for rows, cells, row groups, headers and group headers during PDF export. Returned styles are merged after resolved grid styles and take precedence.
processCellHyperlinkCallbackCopy Link
Function
Callback that provides an external URI for an exported body cell. The returned URI is added to the PDF as a clickable link annotation.
addImageToCellCopy Link
Function
Callback that provides an image for an exported body cell. Return an optional value to replace the exported cell text.
PdfPageSetup
default: { size: 'A4', orientation: 'landscape', margin: 36 }
Page size, orientation and margins.
defaultCellStyleCopy Link
PdfCellStyle
default: { fontFamily: 'Helvetica', fontSize: 10, padding: 4 }
Default style applied to every body cell, including custom content rows. Grid styles, row and cell styles, and processStyleCallback results override these values. When no style is provided, body cells use Helvetica at 10 points.
defaultHeaderStyleCopy Link
PdfCellStyle
default: { fontFamily: 'Helvetica-Bold', fontSize: 11, padding: 4 }
Default style applied to header and group-header cells. Each unset property inherits from defaultCellStyle; values set here take precedence. If neither style sets fontSize, headers use 11 points. If no font weight is inherited or set, headers use the bold variant of the resolved body font.
columnWidthCopy Link
PdfColumnWidth | PdfColumnWidthCallback
default: 'grid'
Controls exported column widths. Use auto to size from exported content, grid to use the current column width in the grid, a number for a width in points, or a callback for per-column control. Widths are proportionally reduced when their total exceeds the printable page width.
rowGroupIndentSizeCopy Link
number
default: 12
Horizontal indentation in points for each row-group level.
rowHeightCopy Link
number
default: calculated from font size and padding
Height of body rows in points. If omitted, calculated from font size and padding.
headerRowHeightCopy Link
number
default: calculated from header font size and padding
Height of header rows in points. If omitted, calculated from header font size and padding.
repeatHeaderCopy Link
boolean
default: true
Set to false to avoid repeating header rows on each page.
drawCellBordersCopy Link
boolean
default: true
Set to false to skip drawing cell borders.
prependContentCopy Link
PdfCustomContent
Content to put at the top of the exported sheet.
appendContentCopy Link
PdfCustomContent
Content to put at the bottom of the exported sheet.
getCustomContentBelowRowCopy Link
Function
A callback function to return content to be inserted below a row in the export.
exportRowNumbersCopy Link
boolean
default: false
Set to true to allow the contents of the Row Numbers column to be exported.
fileNameCopy Link
string | ExportFileNameGetter
default: 'export.pdf'
String to use as the file name or a function that returns a string.
mimeTypeCopy Link
string
default: 'application/pdf'
The mimeType of the PDF file.
allColumnsCopy Link
boolean
default: false
If true, all columns will be exported in the order they appear in the columnDefs. When false only the columns currently being displayed will be exported.
columnKeysCopy Link
(string | Column)[]
Provide a list (an array) of column keys or Column objects if you want to export specific columns.
rowPositionsCopy Link
RowPosition[]
Row node positions.
exportedRowsCopy Link
'all' | 'filteredAndSorted'
default: 'filteredAndSorted'
Determines whether rows are exported before being filtered and sorted.
onlySelectedCopy Link
boolean
default: false
Export only selected rows.
onlySelectedAllPagesCopy Link
boolean
default: false
Only export selected rows including other pages (only makes sense when using pagination).
skipColumnGroupHeadersCopy Link
boolean
default: false
Set to true to exclude header column groups.
skipColumnHeadersCopy Link
boolean
default: false
Set to true if you don't want to export column headers.
skipRowGroupsCopy Link
boolean
default: false
Set to true to skip row group headers if grouping rows. Only relevant when grouping rows.
skipPinnedTopCopy Link
boolean
default: false
Set to true to suppress exporting rows pinned to the top of the grid.
skipPinnedBottomCopy Link
boolean
default: false
Set to true to suppress exporting rows pinned to the bottom of the grid.
skipPinnedRowDuplicatesCopy Link
boolean
default: false
Set to true to omit the body copies of manually pinned rows. The rows in the pinned sections are still exported unless skipPinnedTop or skipPinnedBottom is enabled.
valueFromCopy Link
CellValueResolveFrom
default: 'data'
The base source to use for getting cell values.
  • 'data': values from the underlying row data
  • 'batch': pending batch edit values (falls back to data if not in batch mode)
  • 'edit': current editor values including live typing
  • transformValuesCopy Link
    boolean
    default: true
    Apply the Show Values As transform (e.g. a percentage of a total) on top of the valueFrom base, so the export carries the displayed value for columns with an active mode. Columns without one export the base value.
    shouldRowBeSkippedCopy Link
    Function
    A callback function that will be invoked once per row in the grid. Return true to omit the row from the export.
    processCellCallbackCopy Link
    Function
    A callback function invoked once per cell in the grid. Return a string value to be displayed in the export. For example this is useful for formatting date values.
    processHeaderCallbackCopy Link
    Function
    A callback function invoked once per column. Return a string to be displayed in the column header.
    processGroupHeaderCallbackCopy Link
    Function
    A callback function invoked once per column group. Return a string to be displayed in the column group header. Note that column groups are exported by default, this option will not work with skipColumnGroupHeaders=true.
    processRowGroupCallbackCopy Link
    Function
    A callback function invoked once per row group. Return a string to be displayed in the group cell.

    PdfFontFace Copy Link

    Properties available on the PdfFontFace interface.

    data requiredCopy Link
    ArrayBuffer | Uint8Array
    Static TrueType font data.
    weightCopy Link
    PdfFontWeight
    default: 400
    Weight represented by this face.
    PdfFontStyle
    default: 'normal'
    Style represented by this face.

    PdfFontFamilyDefinition Copy Link

    Properties available on the PdfFontFamilyDefinition interface.

    family requiredCopy Link
    string
    Family name used by PDF styles.
    faces requiredCopy Link
    PdfFontFace[]
    Font faces available for this family.

    PdfGroupHeaderStyleCallbackParams Copy Link

    Properties available on the PdfGroupHeaderStyleCallbackParams<TData = any, TContext = any> interface.

    'groupheader'
    The exported element type currently being styled.
    The current column group.
    accumulatedRowIndexCopy Link
    number
    1-based index of the current exported row.
    any
    The current value for the exported element.
    The grid api.
    Application context as set on gridOptions.context.

    PdfHeaderFooter Copy Link

    Properties available on the PdfHeaderFooter interface.

    headerCopy Link
    PdfHeaderFooterContent[]
    Up to three header entries positioned left, centre, and right.
    PdfHeaderFooterContent[]
    Up to three footer entries positioned left, centre, and right.

    PdfHeaderFooterConfig Copy Link

    Properties available on the PdfHeaderFooterConfig interface.

    PdfHeaderFooter
    Header and footer configuration applied to every page unless overridden.
    PdfHeaderFooter
    Header and footer configuration applied to the first page.
    PdfHeaderFooter
    Header and footer configuration applied to even-numbered pages.

    PdfHeaderFooterImageContent Copy Link

    Properties available on the PdfHeaderFooterImageContent interface.

    string
    Header or footer text. Supports &[Page], &[Pages], &[Date], and &[Time] placeholders.
    PdfImage
    Image rendered alongside the text.
    positionCopy Link
    'Left' | 'Center' | 'Right'
    Position of the content within the printable page width. When omitted, array entries default to left, centre, and right in order.
    PdfTextStyle
    Text styling for this entry.

    PdfHeaderFooterTextContent Copy Link

    Properties available on the PdfHeaderFooterTextContent interface.

    string
    Header or footer text. Supports &[Page], &[Pages], &[Date], and &[Time] placeholders.
    PdfImage
    Image rendered alongside the text.
    positionCopy Link
    'Left' | 'Center' | 'Right'
    Position of the content within the printable page width. When omitted, array entries default to left, centre, and right in order.
    PdfTextStyle
    Text styling for this entry.

    PdfHeaderStyleCallbackParams Copy Link

    Properties available on the PdfHeaderStyleCallbackParams<TData = any, TContext = any> interface.

    'header'
    The exported element type currently being styled.
    The current column.
    accumulatedRowIndexCopy Link
    number
    1-based index of the current exported row.
    any
    The current value for the exported element.
    The grid api.
    Application context as set on gridOptions.context.

    PdfMargin Copy Link

    Properties available on the PdfMargin interface.

    number
    Top margin in points.
    number
    Right margin in points.
    bottomCopy Link
    number
    Bottom margin in points.
    number
    Left margin in points.

    PdfPageSetup Copy Link

    Properties available on the PdfPageSetup interface.

    PdfPageSize
    default: 'A4'
    The size of the PDF page.
    orientationCopy Link
    PdfPageOrientation
    default: 'landscape'
    Page orientation.
    marginCopy Link
    number | PdfMargin
    default: 36
    Page margins in points. A number applies to all sides.

    PdfRowStyleCallbackParams Copy Link

    Properties available on the PdfRowStyleCallbackParams<TData = any, TContext = any> interface.

    'row'
    The exported element type currently being styled.
    The row node for the exported row.
    accumulatedRowIndexCopy Link
    number
    1-based index of the current exported row.
    any
    The current value for the exported element.
    The grid api.
    Application context as set on gridOptions.context.

    PdfTextStyle Copy Link

    Properties available on the PdfTextStyle interface.

    fontSizeCopy Link
    number
    Font size in points.
    fontFamilyCopy Link
    PdfFontFamily
    Font family.
    fontWeightCopy Link
    PdfFontWeight
    Font weight. When omitted, the weight from the resolved font family is preserved.
    fontStyleCopy Link
    PdfFontStyle
    default: 'normal'
    Font style.
    directionCopy Link
    PdfTextDirection
    Text direction. auto uses the first strong directional character. When omitted, the export-level direction is used. Text direction does not change exported column order.
    languageCopy Link
    string
    BCP 47 language tag used when selecting language-specific OpenType features. When omitted, the export-level language is used.
    string
    Text colour.
    lineHeightCopy Link
    number
    Distance between text baselines in points. Defaults to the natural line height from the resolved font metrics, with a minimum of fontSize.

    PdfWatermark Copy Link

    Properties available on the PdfWatermark interface.

    string
    Text displayed diagonally across the exported page content.
    opacityCopy Link
    number
    default: 0.12
    Text opacity from 0 (transparent) to 1 (opaque).
    rotationCopy Link
    number
    default: -45
    Rotation in degrees.
    PdfWatermarkPageSelection
    default: 'all'
    Pages on which the watermark is rendered.
    PdfTextStyle
    Text styling for the watermark.