pageSettings property

PdfPageSettings get pageSettings

Gets or sets the PdfPageSettings of the section.

//Create a new PDF documentation
PdfDocument document = PdfDocument();
//Create a new PDF section
PdfSection section = document.sections!.add();
//Sets the page settings of the section
section.pageSettings =
    PdfPageSettings(PdfPageSize.a4, PdfPageOrientation.portrait);
//Sets the template for the page in the section
section.template = PdfSectionTemplate();
//Create a new PDF page and draw the text
section.pages.add().graphics.drawString(
    'Hello World!!!', PdfStandardFont(PdfFontFamily.helvetica, 27),
    brush: PdfBrushes.darkBlue, bounds: const Rect.fromLTWH(170, 100, 0, 0));
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfPageSettings get pageSettings {
  PdfMarginsHelper.getHelper(_helper.settings.margins).isPageAdded =
      _helper._pages.isNotEmpty;
  PdfPageSettingsHelper.getHelper(_helper.settings).isPageAdded =
      _helper._pages.isNotEmpty;
  return _helper.settings;
}
set pageSettings (PdfPageSettings settings)

Implementation

set pageSettings(PdfPageSettings settings) {
  if (_helper._pages.isEmpty) {
    _helper.settings = settings;
  }
}