PDF Export creates a paginated PDF representation of grid data without requiring third-party libraries. The export follows the grid's current data state and displayed columns, but it is not a screenshot and does not reproduce every visual feature rendered in the browser.
Enabling PDF Export Copy Link
PDF export is available through the Grid API:
api.exportDataAsPdf();The enterprise Context Menu also includes a PDF Export item. For module-based builds, register PdfExportModule and register ContextMenuModule when the menu item is required:
import { ModuleRegistry } from 'ag-grid-community';
import { ContextMenuModule, PdfExportModule } from 'ag-grid-enterprise';
ModuleRegistry.registerModules([
PdfExportModule,
ContextMenuModule,
]);Set suppressPdfExport=true to disable both exportDataAsPdf() and getDataAsPdf().
Default PDF Export Copy Link
The export uses the current column order and visibility, together with the filtered, sorted, and grouped row data. Exported values are produced independently of the rendered grid cells:
- Value Getters are used.
- Value Formatters are used by default through Use Value Formatter for Export.
- Cell Renderer output and HTML are not exported.
- Supported grid styles can be reused, but browser rendering and CSS classes are not copied into the PDF.
Reorder columns or apply filtering and sorting in the following example, then export from the context menu or with the Export to PDF button.
By default, regular columns use their current grid widths and the Row Numbers column is sized from its exported content. Columns are proportionally reduced when their combined width exceeds the printable page width. Cells remain on one line unless wrapping is enabled, and table headers repeat when a table continues onto another page.
PDF Export uses the built-in PDF Base 14 fonts with WinAnsi encoding. Characters outside the supported WinAnsi character set are replaced with ?.
Support And Limitations Copy Link
| Area | Supported | Not Supported |
|---|---|---|
| Grid state | Displayed column order and visibility, sorting, filtering, selected-row export options, grouping, pinned rows, column spans | Cell Renderer output or custom HTML |
| Layout | Named and custom page sizes, margins, orientation, column widths, text wrapping, automatic row height, repeated table headers | Automatic page size, horizontal pagination, page headers and footers |
| Styling | Theme colours, colors, supported rowStyle, cellStyle, and headerStyle properties, PDF-specific style callbacks | cellClass, cellClassRules, arbitrary CSS, browser fonts |
| Content | Value Getters, Value Formatters, export value callbacks, document title, additional content, external URI hyperlinks | Images, SVG, internal page links, embedded files |
| Text | Built-in Helvetica, Times, and Courier families; WinAnsi characters | Embedded custom fonts, full Unicode, RTL layout |
PDF Export Sections Copy Link
- API Reference: PDF export methods, grid options, interfaces, and types.
- Styles: Reuse supported grid styles and apply PDF-specific overrides.
- Extra Content: Customise exported values, titles, and additional content.
- Rows: Select rows and configure filtered, sorted, and pinned-row export.
- Columns: Choose columns, headers, groups, Row Numbers, and widths.
- Hyperlinks: Add external URI links to grid cells and custom content.
- Master Detail: Include a PDF representation of detail data below master rows.
- Page Setup: Configure page size, orientation, margins, and repeated table headers.