orientation property
PdfPageOrientation
get
orientation
Gets the page orientation.
//Create a PDF document.
PdfDocument document = PdfDocument();
//Get the page orientation.
PdfPageOrientation orientation = document.pageSettings.orientation;
//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
PdfPageOrientation get orientation => _orientation;
set
orientation
(PdfPageOrientation value)
Sets the page orientation.
//Create a PDF document.
PdfDocument document = PdfDocument();
//Set the page orientation.
document.pageSettings.orientation = PdfPageOrientation.landscape;
//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 orientation(PdfPageOrientation value) {
if (value != _orientation && !_helper.isPageAdded) {
_orientation = value;
_updateSize(_orientation);
}
}