margins property

PdfMargins get margins

Gets or sets the margins of the PDF page.

//Create a PDF document.
PdfDocument document = PdfDocument();
//Set margins.
document.pageSettings.margins.all = 50;
//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

PdfMargins get margins => _margins;
set margins (PdfMargins value)

Implementation

set margins(PdfMargins value) {
  if (!PdfMarginsHelper.getHelper(_margins).equals(value) &&
      !_helper.isPageAdded) {
    _margins = value;
  }
}