PdfPageTemplateElement class
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 = await 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.
getter/setter pair
- background ↔ bool
-
Indicates whether the page template is located behind of the page layers
or in front of it.
getter/setter pair
- bounds ↔ Rect
-
Gets or sets bounds of the page template element.
getter/setter pair
- dock ↔ PdfDockStyle
-
Gets or sets the dock style of the page template element.
getter/setter pair
- 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.
getter/setter pair
- graphics → PdfGraphics
-
Gets or sets graphics context of the page template element.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ double
-
Gets or sets height of the page template element.
getter/setter pair
- location ↔ Offset
-
Gets or sets location of the page template element.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size ↔ Size
-
Gets or sets the size of the page template element.
getter/setter pair
- width ↔ double
-
Gets or sets width of the page template element.
getter/setter pair
- x ↔ double
-
Gets or sets X co-ordinate of the template element on the page.
getter/setter pair
- y ↔ double
-
Gets or sets Y co-ordinate of the template element on the page.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited