size property
Size
get
size
Gets the size fo the page.
//Create a PDF document.
PdfDocument document = PdfDocument();
//Get the page size.
Size pageSize = document.pageSettings.size;
//Create page and draw text.
document.pages.add().graphics.drawString(
'Hello World!', PdfStandardFont(PdfFontFamily.helvetica, 12),
brush: PdfBrushes.black, bounds: Rect.fromLTWH(0, 0, 0, 0));
//Save and dispose document.
List<int> bytes = await document.save();
document.dispose();
Implementation
Size get size => _size.size;
set
size
(Size value)
Sets the page size.
//Create a PDF document.
PdfDocument document = PdfDocument();
//Set the page size.
document.pageSettings.size = Size(595, 842);
//Create page and draw text.
document.pages.add().graphics.drawString(
'Hello World!', PdfStandardFont(PdfFontFamily.helvetica, 12),
brush: PdfBrushes.black, bounds: Rect.fromLTWH(0, 0, 0, 0));
//Save and dispose document.
List<int> bytes = await document.save();
document.dispose();
Implementation
set size(Size value) {
if (!_helper.isPageAdded) {
_updateSize(_orientation, value);
}
}