[]
        
(Showing Draft Content)

FlexGridPdfConverter Class

FlexGridPdfConverter Class

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:

Example

Heirarchy

  • FlexGridPdfConverter

Methods

Static draw

  • draw(flex: any, doc: pdf.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'
          }
       }
    });
    

    Parameters

    • flex: any

      The FlexGrid instance to export.

    • doc: pdf.PdfDocument

      The PdfDocument instance to draw in.

    • Optional width: number

      The width of the drawing area in points.

    • Optional height: number

      The height of the drawing area in points.

    • Optional settings: IFlexGridDrawSettings

      The draw settings.

    Returns void

Static drawToPosition

  • drawToPosition(flex: any, doc: 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'
          }
       }
    });
    

    Parameters

    • flex: any

      The FlexGrid instance to export.

    • doc: pdf.PdfDocument

      The PdfDocument instance to draw in.

    • point: Point

      The position to draw at, in points.

    • Optional width: number

      The width of the drawing area in points.

    • Optional height: number

      The height of the drawing area in points.

    • Optional settings: IFlexGridDrawSettings

      The draw settings.

    Returns void

Static export

  • 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'
          }
       }
    });
    

    Parameters

    • flex: grid.FlexGrid

      The FlexGrid instance to export.

    • fileName: string

      Name of the file to export.

    • Optional settings: IFlexGridExportSettings

      The export settings.

    Returns void