imagePosition property

PdfGridImagePosition get imagePosition

Gets or sets the image alignment type of the PdfGridCell image.

//Create a new PDF document
PdfDocument document = PdfDocument();
//Create a PdfGrid
PdfGrid grid = PdfGrid();
//Add columns to grid
grid.columns.add(count: 3);
//Add headers to grid
PdfGridRow header = grid.headers.add(1)[0];
header.cells[0].value = 'Employee ID';
header.cells[1].value = 'Employee Name';
header.cells[2].value = 'Salary';
//Add rows to grid
PdfGridRow row1 = grid.rows.add();
PdfGridCell cell1 = row1.cells[0];
//Sets the image alignment type of the PdfGridCell image
cell1.imagePosition = PdfGridImagePosition.center;
cell1.style.backgroundImage = PdfBitmap(imageData);
cell1.style.cellPadding = PdfPaddings(left: 0, right: 0, top: 10, bottom: 10);
row1.cells[1].value = 'Clay';
row1.cells[2].value = '\$10000';
PdfGridRow row2 = grid.rows.add();
row2.cells[0].value = 'E02';
row2.cells[1].value = 'Simon';
row2.cells[2].value = '\$12,000';
grid.draw(
    page: document.pages.add(), bounds: Rect.zero);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfGridImagePosition get imagePosition => _imagePosition;
set imagePosition (PdfGridImagePosition value)

Implementation

set imagePosition(PdfGridImagePosition value) {
  if (_imagePosition != value) {
    _imagePosition = value;
  }
}