PdfPageTemplateElement class Null safety

Describes a page template object that can be used as header/footer, watermark or stamp.

//Create a new pdf document
PdfDocument document = PdfDocument();
//Create a header and add the top of the document.
document.template.top = PdfPageTemplateElement(Rect.fromLTWH(0, 0, 515, 50))
  ..graphics.drawString(
      'Header', PdfStandardFont(PdfFontFamily.helvetica, 14),
      brush: PdfBrushes.black);
//Create footer and add the bottom of the document.
document.template.bottom =
    PdfPageTemplateElement(Rect.fromLTWH(0, 0, 515, 50))
      ..graphics.drawString(
          'Footer', PdfStandardFont(PdfFontFamily.helvetica, 11),
          brush: PdfBrushes.black);
//Add the pages to the document
for (int i = 1; i <= 5; i++) {
  document.pages.add().graphics.drawString(
      'Page $i', PdfStandardFont(PdfFontFamily.timesRoman, 11),
      bounds: Rect.fromLTWH(250, 0, 515, 100));
}
//Save the document.
List<int> bytes = document.save();
//Dispose the document.
document.dispose();

Constructors

PdfPageTemplateElement(Rect bounds, [PdfPage? page])
Initializes a new instance of the PdfPageTemplateElement class. [...]

Properties

alignment PdfAlignmentStyle
Gets or sets the alignment of the page template element. [...]
read / write
background bool
Indicates whether the page template is located behind of the page layers or in front of it. [...]
read / write
bounds Rect
Gets or sets bounds of the page template element. [...]
read / write
dock PdfDockStyle
Gets or sets the dock style of the page template element. [...]
read / write
foreground bool
Indicates whether the page template is located in front of the page layers or behind of it. If false, the page template will be located behind of page layer.
read / write
graphics PdfGraphics
Gets or sets graphics context of the page template element. [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
height double
Gets or sets height of the page template element. [...]
read / write
location Offset
Gets or sets location of the page template element. [...]
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size Size
Gets or sets the size of the page template element. [...]
read / write
width double
Gets or sets width of the page template element. [...]
read / write
x double
Gets or sets X co-ordinate of the template element on the page. [...]
read / write
y double
Gets or sets Y co-ordinate of the template element on the page. [...]
read / write

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited