locale property
Gets or sets the locale for date and time culture.
//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)));
//Sets the date and time locale
dateTimeField.locale = 'en_US';
//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();
Implementation
String locale = 'en_US';