More Samples
Download Wijmo

Export FlexGrid to the PdfDocument instance

This sample shows how to export FlexGrid to an existing PdfDocument using draw and drawToPosition methods with different settings.

Apart from export method, FlexGridPdfConverter also provides the draw and drawToPosition class methods which are used to export FlexGrid to an existing PdfDocument instance.

Here is the differences between these methods:

  1. The draw method draws a grid in text flow by using (0, doc.y) coordinates as the position to draw at, while drawToPosition method draws the grid at a specific position only.
  2. The draw method can break a grid into multiple pages depending on scaling settings provided by the width and height arguments, while drawToPosition method always uses a single page to draw.

The following code snippet shows usage of these methods:

wijmo.grid.pdf.FlexGridPdfConverter.draw(grid, doc);
wijmo.grid.pdf.FlexGridPdfConverter.drawToPosition(grid, doc, new wijmo.Point(0, 300));