PdfDateTimeField class

Represents date and time automated field.

//Create a new pdf document
PdfDocument document = PdfDocument();
//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, 615, 100));
}
//Create the footer with specific bounds
PdfPageTemplateElement footer =
    PdfPageTemplateElement(const Rect.fromLTWH(0, 0, 515, 50));
//Create the composite field
PdfCompositeField compositeField = PdfCompositeField(
    font: PdfStandardFont(PdfFontFamily.timesRoman, 19),
    brush: PdfSolidBrush(PdfColor(0, 0, 0)),
    text: 'Time:{0}');
//Create the date and time field
PdfDateTimeField dateTimeField = PdfDateTimeField(
    font: PdfStandardFont(PdfFontFamily.timesRoman, 19),
    brush: PdfSolidBrush(PdfColor(0, 0, 0)));
//Add date&time field to composite fields
compositeField.fields.add(dateTimeField);
//Set bounds to composite field.
compositeField.bounds = footer.bounds;
//Add the composite field in footer
compositeField.draw(footer.graphics,
    Offset(290, 50 - PdfStandardFont(PdfFontFamily.timesRoman, 19).height));
//Add the footer at the bottom of the document
document.template.bottom = footer;
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Inheritance

Constructors

PdfDateTimeField({PdfFont? font, PdfBrush? brush, Rect? bounds})
Initializes a new instance of the PdfDateTimeField class.

Properties

bounds Rect
Gets or sets the bounds of the field.
getter/setter pairinherited
brush PdfBrush
Gets or sets the brush of the field.
getter/setter pairinherited
date DateTime
Get the current date and set the required date.
getter/setter pair
dateFormatString String
Gets or sets the date format string.
getter/setter pair
font PdfFont
Gets or sets the font of the field.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
locale String
Gets or sets the locale for date and time culture.
getter/setter pair
pen PdfPen?
Gets or sets the pen of the field.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringFormat PdfStringFormat?
Gets or sets the stringFormat of the field.
getter/setter pairinherited

Methods

draw(PdfGraphics graphics, [Offset? location]) → void
Draws an element on the Graphics. Graphics context where the element should be printed. location has contains X co-ordinate of the element, Y co-ordinate of the element.
inherited
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