allowRowBreakingAcrossPages property
Gets or sets a value indicating whether to split or cut rows that overflow a page.
//Create a new PDF document
PdfDocument document = PdfDocument();
//Create a PdfGrid class
PdfGrid grid = PdfGrid();
//Sets allowRowBreakingAcrossPages
grid.allowRowBreakingAcrossPages = true;
//Add the columns to the grid
grid.columns.add(count: 3);
//Add header to the grid
grid.headers.add(100);
//Add the rows to the grid
for (int i = 0; i < 100; i++) {
final PdfGridRow header = grid.headers[i];
header.cells[0].value = 'Header - $i Cell - 1';
final PdfTextElement element = PdfTextElement(font: PdfStandardFont(PdfFontFamily.timesRoman, 15));
element.text =
'Header - $i Cell - 2 Sample text for pagination. Lorem ipsum dolor sit amet,\r\n consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua';
header.cells[1].value = element;
header.cells[2].value = 'Header - $i Cell - 3';
}
//Add rows to grid
PdfGridRow row = grid.rows.add();
row.cells[0].value = 'E01';
row.cells[1].value = 'Clay';
row.cells[2].value = '\$10,000';
row = grid.rows.add();
row.cells[0].value = 'E02';
row.cells[1].value = 'Simon';
row.cells[2].value = '\$12,000';
//Draw the grid
grid.draw(
page: document.pages.add(), bounds: Rect.zero);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Implementation
late bool allowRowBreakingAcrossPages;