Class PdfDateTimeField
Represents date and time automated field.
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfDateTimeField : PdfStaticField
Examples
//Creates a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document.
PdfPage page = doc.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates DateTime field.
PdfDateTimeField dateTimeField = new PdfDateTimeField(font);
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy";
for (int i = 0; i !=3; i++)
{
page = doc.Pages.Add();
dateTimeField.Draw(page.Graphics);
}
doc.Save("DateTimeField.pdf")
doc.Close(True)
'Creates a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a page.
Dim page As PdfPage = doc.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
'Creates DateTime field.
Dim dateTimeField As PdfDateTimeField = New PdfDateTimeField(font)
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy"
For i As Integer = 0 To 2
page = doc.Pages.Add()
dateTimeField.Draw(page.Graphics)
Next i
doc.Save("DateTimeField.pdf")
doc.Close(True)
Constructors
PdfDateTimeField()
Initializes a new instance of the PdfDateTimeField class.
Declaration
public PdfDateTimeField()
Examples
//Creates a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document.
PdfPage page = doc.Pages.Add();
//Creates DateTime field.
PdfDateTimeField dateTimeField = new PdfDateTimeField();
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy";
for (int i = 0; i!=3; i++)
{
page = doc.Pages.Add();
dateTimeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
'Creates a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a page.
Dim page As PdfPage = doc.Pages.Add()
'Creates DateTime field.
Dim dateTimeField As PdfDateTimeField = New PdfDateTimeField()
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy"
For i As Integer = 0 To 2
page = doc.Pages.Add()
dateTimeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
PdfDateTimeField(PdfFont)
Initializes a new instance of the PdfDateTimeField class with PdfFont.
Declaration
public PdfDateTimeField(PdfFont font)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use. |
Examples
//Creates a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document.
PdfPage page = doc.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates DateTime field.
PdfDateTimeField dateTimeField = new PdfDateTimeField(font);
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy";
for (int i = 0; i !=3; i++)
{
page = doc.Pages.Add();
dateTimeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
'Creates a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a page.
Dim page As PdfPage = doc.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
'Creates DateTime field.
Dim dateTimeField As PdfDateTimeField = New PdfDateTimeField(font)
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy"
For i As Integer = 0 To 2
page = doc.Pages.Add()
dateTimeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
PdfDateTimeField(PdfFont, RectangleF)
Initializes a new instance of the PdfDateTimeField class with PdfFont and rectangle bounds
Declaration
public PdfDateTimeField(PdfFont font, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use. |
RectangleF | bounds | Specifies the location and size of the field. |
Examples
//Creates a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document.
PdfPage page = doc.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates DateTime field.
PdfDateTimeField dateTimeField = new PdfDateTimeField(font, new RectangleF(new PointF(10,10), new SizeF(100,200)));
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy";
for (int i = 0; i!=3; i++)
{
page = doc.Pages.Add();
dateTimeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
'Creates a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a page.
Dim page As PdfPage = doc.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
'Creates DateTime field.
Dim dateTimeField As PdfDateTimeField = New PdfDateTimeField(font, New RectangleF(New PointF(10,10), New SizeF(100,200)))
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy"
For i As Integer = 0 To 2
page = doc.Pages.Add()
dateTimeField.Draw(page.Graphics)
Next i
'Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
PdfDateTimeField(PdfFont, PdfBrush)
Initializes a new instance of the PdfDateTimeField class with PdfFont and PdfBrush.
Declaration
public PdfDateTimeField(PdfFont font, PdfBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfFont | font | A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use. |
PdfBrush | brush | A PdfBrush object that is used to fill the string. |
Examples
//Creates a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document.
PdfPage page = doc.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates DateTime field.
PdfDateTimeField dateTimeField = new PdfDateTimeField(font, PdfBrushes.Aquamarine);
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy";
for (int i = 0; i!=3; i++)
{
page = doc.Pages.Add();
dateTimeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
'Creates a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a page.
Dim page As PdfPage = doc.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
'Creates DateTime field.
Dim dateTimeField As PdfDateTimeField = New PdfDateTimeField(font, PdfBrushes.Aquamarine)
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy"
For i As Integer = 0 To 2
page = doc.Pages.Add()
dateTimeField.Draw(page.Graphics)
Next i
'Save and clos ethe document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
Properties
DateFormatString
Gets or sets the date format string.
Declaration
public string DateFormatString { get; set; }
Property Value
Type | Description |
---|---|
System.String | The format string. |
Examples
//Creates a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document.
PdfPage page = doc.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates DateTime field.
PdfDateTimeField dateTimeField = new PdfDateTimeField(font, new RectangleF(new PointF(10,10), new SizeF(100,200)));
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy";
for (int i = 0; i!=3; i++)
{
page = doc.Pages.Add();
dateTimeField.Draw(page.Graphics);
}
//Save and close the document.
doc.Save("DateTimeField.pdf")
doc.Close(True)
'Creates a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a page.
Dim page As PdfPage = doc.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f)
'Creates DateTime field.
Dim dateTimeField As PdfDateTimeField = New PdfDateTimeField(font, New RectangleF(New PointF(10,10), New SizeF(100,200)))
dateTimeField.DateFormatString = "dd'/'MMMM'/'yyyy"
For i As Integer = 0 To 2
page = doc.Pages.Add()
dateTimeField.Draw(page.Graphics)
Next i
'Save and clos ethe document.
doc.Save("DateTimeField.pdf")
doc.Close(True)