Provides a functionality to export the FlexGrid to PDF.
The example below shows how you can use a FlexGridPdfConverter to export a FlexGrid to PDF:
{@sample Grid/ImportExportPrint/PDF/ExportToFile/purejs Example}
draw(flex: any, doc: PdfDocument, width?: number, height?: number, settings?: IFlexGridDrawSettings): void
Draws the FlexGrid to an existing PdfDocument at the (0, @wijmo.pdf.PdfDocument.y) coordinates.
If both, **width** and **height** are determined, then grid will be scaled to fit the specified rectangle without any page breaks. If only **width** is specifed, then grid will be scaled to fit the width, breaking into pages vertically as needed. Otherwise grid will be rendered in actual size, breaking into pages as needed.
var doc = new wijmo.pdf.PdfDocument({ ended: function (sender, args) { wijmo.pdf.saveBlob(args.blob, 'FlexGrid.pdf'); } }); wijmo.grid.pdf.FlexGridPdfConverter.draw(grid, doc, null, null, { maxPages: 10, styles: { cellStyle: { backgroundColor: '#ffffff', borderColor: '#c6c6c6' }, headerCellStyle: { backgroundColor: '#eaeaea' } } });
The FlexGrid instance to export.
The PdfDocument instance to draw in.
The width of the drawing area in points.
The height of the drawing area in points.
The draw settings.
drawToPosition(flex: any, doc: wijmo.pdf.PdfDocument, point: Point, width?: number, height?: number, settings?: IFlexGridDrawSettings): void
Draws the FlexGrid to an existing PdfDocument instance at the specified coordinates.
If both, **width** and **height** are determined, then grid will be scaled to fit the specified rectangle without any page breaks. If only **width** is specified, then grid will be scaled to fit the width without any page breaks. Othwerwise grid will be rendered in actual size without any page breaks.
var doc = new wijmo.pdf.PdfDocument({
ended: function (sender, args) {
wijmo.pdf.saveBlob(args.blob, 'FlexGrid.pdf');
}
});
wijmo.grid.pdf.FlexGridPdfConverter.drawToPosition(grid, doc, new wijmo.Point(0, 0), null, null, {
maxPages: 10,
styles: {
cellStyle: {
backgroundColor: '#ffffff',
borderColor: '#c6c6c6'
},
headerCellStyle: {
backgroundColor: '#eaeaea'
}
}
});
The FlexGrid instance to export.
The PdfDocument instance to draw in.
The position to draw at, in points.
The width of the drawing area in points.
The height of the drawing area in points.
The draw settings.
export(flex: FlexGrid, fileName: string, settings?: IFlexGridExportSettings): void
Exports the FlexGrid to PDF.
wijmo.grid.pdf.FlexGridPdfConverter.export(grid, 'FlexGrid.pdf', {
scaleMode: wijmo.grid.pdf.ScaleMode.PageWidth,
maxPages: 10,
styles: {
cellStyle: {
backgroundColor: '#ffffff',
borderColor: '#c6c6c6'
},
headerCellStyle: {
backgroundColor: '#eaeaea'
}
},
documentOptions: {
info: {
title: 'Sample'
}
}
});
The FlexGrid instance to export.
Name of the file to export.
The export settings.