PDF Export can embed JPEG and PNG images in grid cells, page headers, and page footers. Images are embedded directly in the generated document without third-party libraries.
Images In Grid Cells Copy Link
Load each image as a base64 string before export, then use addImageToCell to provide an image for an exported body cell. The callback receives the final exported cell value, row node, and column. Return the image together with the text that should appear alongside it.
const gridOptions = {
addImageToCell: (params) => {
if (params.column.getColId() !== 'country') {
return;
}
return {
image: {
id: params.node.data.countryCode,
base64: flagImages[params.node.data.countryCode],
imageType: 'png',
width: 18,
height: 12,
},
value: params.value,
};
},
// other grid options ...
}The image id is used to embed repeated images only once. Supply either width or height in PDF points and the image keeps its original aspect ratio; supplying both stretches the image to those exact dimensions. Use alignment to render the image before ('start', the default) or after ('end') the cell text, and gap to control the space between the image and the text.
The following example displays country flags with a Cell Renderer and exports the same flags alongside the country names in the PDF.
import {
ClientSideRowModelModule,
GridApi,
GridOptions,
ModuleRegistry,
PdfCellImageCallbackParams,
createGrid,
enableDevValidations,
} from "ag-grid-community";
import {
ColumnMenuModule,
ContextMenuModule,
PdfExportModule,
} from "ag-grid-enterprise";
import { CountryCellRenderer } from "./countryCellRenderer";
import { flagImages } from "./data";
import { CountryData, ImageContext } from "./interfaces";
// Enable extended validations only for development
if (process.env.NODE_ENV !== "production") {
enableDevValidations();
}
ModuleRegistry.registerModules([
ClientSideRowModelModule,
PdfExportModule,
ColumnMenuModule,
ContextMenuModule,
]);
let gridApi: GridApi<CountryData>;
const rows: CountryData[] = [
{
country: "United Kingdom",
countryCode: "gb",
capital: "London",
population: "68.3 million",
},
{
country: "United States",
countryCode: "us",
capital: "Washington, D.C.",
population: "340.1 million",
},
{
country: "Germany",
countryCode: "de",
capital: "Berlin",
population: "84.7 million",
},
{
country: "Brazil",
countryCode: "br",
capital: "Brasília",
population: "212.6 million",
},
];
const gridOptions: GridOptions<CountryData> = {
columnDefs: [
{
field: "country",
minWidth: 190,
cellRenderer: CountryCellRenderer,
},
{ field: "capital", minWidth: 170 },
{ field: "population", minWidth: 150 },
],
defaultColDef: {
flex: 1,
},
defaultPdfExportParams: {
addImageToCell: (params: PdfCellImageCallbackParams<CountryData>) => {
const countryCode = params.node.data?.countryCode;
const flagImage = countryCode ? flagImages[countryCode] : undefined;
if (
params.column.getColId() !== "country" ||
!countryCode ||
!flagImage
) {
return;
}
return {
image: {
id: `flag-${countryCode}`,
base64: flagImage,
imageType: "png",
width: 20,
height: 10,
altText: `${params.value} flag`,
},
value: params.value,
};
},
},
context: {
flagImages,
} as ImageContext,
rowData: rows,
};
function onBtExport() {
gridApi.exportDataAsPdf();
}
gridApi = createGrid(
document.querySelector<HTMLElement>("#myGrid")!,
gridOptions,
);
if (typeof window !== "undefined") {
// Attach external event handlers to window so they can be called from index.html
(<any>window).onBtExport = onBtExport;
}
.example-wrapper {
display: flex;
flex-direction: column;
height: 100%;
}
.controls {
margin-bottom: 8px;
}
#myGrid {
flex: 1 1 0px;
width: 100%;
}
.country-flag {
height: 14px;
margin-right: 8px;
object-fit: contain;
vertical-align: middle;
width: 21px;
}
export const flagImages: Record<string, string> = {
gb: 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAUCAMAAADImI+JAAAANlBMVEX////w8vfyxcx8jbJCWpAOLHFVa5sBIWnIEC7WTGLnv8qAkLTheYpecqHx0digrMfz3+T21dqBS5WQAAAApUlEQVQoz8WTyxpFMAyEpyqOuhTv/7IntImmurAzC59kfsIIhA5wnn6iASMLgzbIT2Fk6joUaAUKBsiJm+kJ0iyuR1mQBam8Cex1dINkZ6EesSZwrR8JfdYWl7AcbCRw5ypytYmPpy6w3X6jL8HXL6PxOODgTPYEcnXmFe94cuBsdJzwpIFrRwK3WPkJLQqL2aUoUVisXjOvLizWWNyMVljrV0gz/wdhEi0lRIbcAAAAAElFTkSuQmCC',
us: 'iVBORw0KGgoAAAANSUhEUgAAACYAAAAUCAMAAADWUb86AAAANlBMVEXZjKGzGUL////GU3IKMWEPNmUbP2wiRXFXcpNGY4hfeJhsg6A8P2o1OGSiS27O1d+RHUeveZPx6bSjAAAAiUlEQVQoz8WPWQ7DIBQDXxK/DUiX+1+2puryAxV/HaRRJCw7CJznLcNtGyIalmaUe9ddxsCKeVJMh+O6DxEt7NPQNH6lz0bBW0/KkmHMRrVqMSq60mejQIUnZYGquBxDhLf935COQs1inzZ/tk1f+moL+9l2trO1r2axfQk5lliNLY4usi3xl9EHqT4JB9bfy1wAAAAASUVORK5CYII=',
de: 'iVBORw0KGgoAAAANSUhEUgAAACEAAAAUBAMAAADxfUlCAAAAD1BMVEUAAABKAADdAAD0igD/zgDupiNjAAAAIUlEQVQY02NgoCMQRAMCDEpoQIGGIsZowIDBBQ040E4EAM/nLQEUDzk4AAAAAElFTkSuQmCC',
br: 'iVBORw0KGgoAAAANSUhEUgAAAB0AAAAUCAMAAABGQsb1AAAAhFBMVEUAlED/ywAwJoH7yAKluBZBoi8HlT7cwwk3LYMTmDtgTGQonTXFvw5gqCjsxgVLRYwYmTqIsR6dfDw4LHtRSpRANoNapynltRDPr1ClgzfEmySmtMRZV5aOpLPwvgnTqBt5YFNKO3BIOXG1x8x2b6t+ryDD0taVmLt9ladfV55uXnidlFzb5JoEAAAArElEQVQoz62RRw6DQBAEmV7CsoQlmpyd/f//+YCQAYOQJfe1pFFNt6L8K/pJ34eaQYa2w0yViIhUcws6bt12YdfWrvPFLJuaHgDQN2RbSxufEXs+Ig4AghG76AsborS6V8VQnIGc6GPnjTZBBADyNpTB3G6i4AAHoutrpN78ci45wDkg0/nlyUpAIuYoBSPm6+uPkhAAj+Nk/dHYBstEKDK20cZRkwcrHC34Y95zFAiJFEm9WAAAAABJRU5ErkJggg==',
};
export interface CountryData {
country: string;
countryCode: string;
capital: string;
population: string;
}
export interface ImageContext {
flagImages: Record<string, string>;
}
import type { ICellRendererComp, ICellRendererParams } from 'ag-grid-community';
import type { CountryData, ImageContext } from './interfaces';
export class CountryCellRenderer implements ICellRendererComp {
private readonly eGui = document.createElement('div');
public init(params: ICellRendererParams<CountryData, string, ImageContext>): void {
const data = params.data;
const image = document.createElement('img');
image.alt = data ? `${data.country} flag` : '';
image.className = 'country-flag';
image.src = data ? `data:image/png;base64,${params.context.flagImages[data.countryCode]}` : '';
this.eGui.append(image, document.createTextNode(params.value ?? ''));
}
public getGui(): HTMLElement {
return this.eGui;
}
public refresh(): boolean {
return false;
}
}
<div class="example-wrapper">
<div class="controls">
<button onclick="onBtExport()">Export PDF</button>
</div>
<div id="myGrid"></div>
</div>
Cell Renderer output is not captured automatically. Use addImageToCell to explicitly provide the image data required by the PDF.
Images In Page Headers And Footers Copy Link
Set image on a PdfHeaderFooterContent entry to add a company logo or other image to a page header or footer. An entry can contain an image, text, or both.
const defaultPdfExportParams = {
headerFooterConfig: {
all: {
header: [
{
position: 'Left',
image: {
id: 'company-logo',
base64: companyLogo,
imageType: 'png',
width: 92,
},
},
{
position: 'Right',
value: 'Page &[Page] of &[Pages]',
},
],
},
},
};The exported page colours follow the grid theme, so a logo designed for a light page can be hard to see when the grid uses a dark theme. Supply a logo variant for each theme and select one when exporting — reading the grid's background colour at export time keeps the choice in step with the active theme.
The following example adds the AG Grid logo to every page header, selecting a light or dark logo variant from the grid's background colour.
import {
ClientSideRowModelModule,
GridApi,
GridOptions,
ModuleRegistry,
PdfExportParams,
createGrid,
enableDevValidations,
} from "ag-grid-community";
import {
ColumnMenuModule,
ContextMenuModule,
PdfExportModule,
} from "ag-grid-enterprise";
import { companyLogoDarkTheme, companyLogoLightTheme } from "./data";
// Enable extended validations only for development
if (process.env.NODE_ENV !== "production") {
enableDevValidations();
}
ModuleRegistry.registerModules([
ClientSideRowModelModule,
PdfExportModule,
ColumnMenuModule,
ContextMenuModule,
]);
let gridApi: GridApi;
const gridOptions: GridOptions = {
columnDefs: [{ field: "region" }, { field: "product" }, { field: "revenue" }],
defaultColDef: {
flex: 1,
},
defaultPdfExportParams: {
documentTitle: "Annual Revenue",
},
rowData: Array.from({ length: 35 }, (_, index) => ({
region: ["Americas", "EMEA", "APAC"][index % 3],
product: ["Analytics", "Data Grid", "Reporting"][index % 3],
revenue: `$${(125000 + index * 7350).toLocaleString("en-US")}`,
})),
onGridReady: (params) => {
// the logo variant depends on the rendered grid theme, so configure the header once the grid
// exists. Setting the grid option keeps the header on context menu exports as well as the button.
params.api.setGridOption("defaultPdfExportParams", getPdfExportParams());
},
};
function getHeaderLogo() {
// exported page colours follow the grid theme, so pick the logo variant that stays visible.
const gridBackground = getComputedStyle(
document.querySelector<HTMLElement>(".ag-root-wrapper")!,
).backgroundColor;
const [red = 255, green = 255, blue = 255] =
gridBackground.match(/\d+(\.\d+)?/g)?.map(Number) ?? [];
const isDarkTheme = red * 0.299 + green * 0.587 + blue * 0.114 < 128;
return isDarkTheme
? { id: "company-logo-dark", base64: companyLogoDarkTheme }
: { id: "company-logo-light", base64: companyLogoLightTheme };
}
function getPdfExportParams(): PdfExportParams {
return {
documentTitle: "Annual Revenue",
headerFooterConfig: {
all: {
header: [
{
position: "Left",
image: {
...getHeaderLogo(),
imageType: "png",
width: 92,
altText: "AG Grid",
},
},
{
position: "Right",
value: "Page &[Page] of &[Pages]",
},
],
},
},
};
}
function onBtExport() {
gridApi.exportDataAsPdf();
}
gridApi = createGrid(
document.querySelector<HTMLElement>("#myGrid")!,
gridOptions,
);
if (typeof window !== "undefined") {
// Attach external event handlers to window so they can be called from index.html
(<any>window).onBtExport = onBtExport;
}
.example-wrapper {
display: flex;
flex-direction: column;
height: 100%;
}
.controls {
margin-bottom: 8px;
}
#myGrid {
flex: 1 1 0px;
width: 100%;
}
export const companyLogoLightTheme =
'iVBORw0KGgoAAAANSUhEUgAAAO4AAABGCAYAAADLoaihAAAIuUlEQVR4AezTBRWCQRgAwSMkjaAP7m6x7qPD7zLz3kbYBAAAAAAAAAAAAAAAAAAAwLBExGRzvkfTrU+3nADjQvuMCxgXSjPubPfK09UvSrX8NjU/GHe+e0XpaY2LcTs7bQPjwp+9c4CWo8ni+A3XuyfrzTp2pqpjO2tbL2/unTg5q8+2bdu2bdu2bb18/Y/nvdvTXT09PQ/1P+d+yLCn61e3LqoScANZmVt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MmyP0uD5ltFq7JToBMhSD3bSRkegUo7g0fsam4WyHzqubsbFaK6/4VUV5xO0AmCgMCWACZJDyq2EY7yFxEtiD2ewhkuluYsxIycx34bPiPAMW9amNxD0DmRc3Z4XZ8HORsab3S5kAk7EwnE5cVlra439kQBZmfLMxqBJkUPGdx316DTDLucLG4GyDztebsB916xLVeWq+4pWF3opBDcdndAcicx90W9ruxn1nZLcx6GDchsxxhFubNNX4Ed6W4MyDTQXN2ETeLe7AIF1ewWSv+zsXdASdSVrGtQlBlJfKY2OdPcAMy9YM4D/2gSi+EmphTG6p84HJxa0ImEndqfCneFreKu690WY2CesXVefqahIkmbYfMTj8/FBugyg68rvm1pPGQOalffuXc+3EZqkzBfQHWz4qOSIHMHB9xubhPIRkyS5HT4LP8HiDOF9d6ab3iTjb+yCLoywY/USz7AM5BlWRMQxE8jztxL15DVWyDKgl414bz8TkSocoVDMSPeBq34gF8iOY4DVVO4U63iytvX5Ed+AbhqQr7NuaBOF5cSlvOTEG94oo3IBIh853FeWsgM8XPsm/hIuxIIkrYeF5KIgF25DLe9JE0Ku6TiA1waeVx+QzGjUserZfVK247yJxAmMV5xXQ+GhKPvBsQTOLwvQPn5n2cQzA5iKd9xOXiyuV+QyLMZBLOesVNf6XNiguQaRjEzOyIhEx7g3UiUBRHYCYJGID7HDxHt6E5YizcmbRHbh9Jw+LK74iOhE5mIDsOpL/iesUt4acM9zjwda6XkV3jjuRPDMJJqHITS1Abj7p4ru5EGUxGNFSJwWSUwq1iRFoWV351UAeDZxJ7UQEh/1l+m1dcL1YurngAr+JZ3JHOfmf5MbyOJ5ErDf8so/DUTPwW2Ev4EcXwHZ7xmck/2oMDAQAAAAAg/9dGUFVVVVVVVVVVVVVVVVVVVQW0cAYshQ2ijQAAAABJRU5ErkJggg==';
<div class="example-wrapper">
<div class="controls">
<button onclick="onBtExport()">Export PDF</button>
</div>
<div id="myGrid"></div>
</div>
Known Limitations Copy Link
- PNG and JPEG are the supported formats. Typical web images work as-is, including PNG transparency, palette PNGs, and progressive JPEGs.
- GIF, SVG, WebP, animated images, interlaced PNG, 16-bit PNG, CMYK JPEG, lossless JPEG, and image collections are not supported.
- Cell Renderer output and images referenced by HTML or CSS are not captured automatically.
- A cell or page header/footer entry can contain one image.
- Images cannot currently be used on cover pages or as watermarks.
- Images cannot currently contain hyperlink annotations.
- Source images are embedded at their supplied resolution. Use appropriately sized images to limit the exported file size.
API Copy Link
Export Options Copy Link
Page header and footer content.
|
Callback that provides an image for an exported body cell. Return an optional value to replace the exported cell text.
|
PdfImage Copy Link
Properties available on the PdfImage interface.
Identifier used to embed repeated images only once in the PDF.
|
Base64 image data, with or without a data URL prefix.
|
Image format.
|
Alternative text for the image.
|
Rendered width in points. When omitted, the intrinsic image width is used at 96 DPI. Setting only one of width and height preserves the aspect ratio; setting both stretches the image to those dimensions.
|
Rendered height in points. When omitted, the intrinsic image height is used at 96 DPI. Setting only one of width and height preserves the aspect ratio; setting both stretches the image to those dimensions.
|
Image alignment relative to adjacent text. |
Space between the image and adjacent text in points. |
PdfCellImageCallbackParams Copy Link
Properties available on the PdfCellImageCallbackParams<TData = any, TContext = any> interface.
The final text exported for the cell. |
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. |
PdfCellImageResult Copy Link
Properties available on the PdfCellImageResult interface.
Image rendered in the exported cell. |
Text rendered alongside the image. When omitted, the exported cell text is removed. |
PdfHeaderFooterTextContent Copy Link
Properties available on the PdfHeaderFooterTextContent interface.
Header or footer text. Supports &[Page], &[Pages], &[Date], and &[Time] placeholders.
|
Image rendered alongside the text. |
Position of the content within the printable page width. When omitted, array entries default to left, centre, and right in order.
|
Text styling for this entry. |
PdfHeaderFooterImageContent Copy Link
Properties available on the PdfHeaderFooterImageContent interface.
Header or footer text. Supports &[Page], &[Pages], &[Date], and &[Time] placeholders.
|
Image rendered alongside the text. |
Position of the content within the printable page width. When omitted, array entries default to left, centre, and right in order.
|
Text styling for this entry. |