Table of Contents

Class PdfDateTimeField

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

Represents date and time automated field.

public class PdfDateTimeField : PdfStaticField
Inheritance
PdfDateTimeField
Inherited Members

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.

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)
See Also

PdfDateTimeField(PdfFont)

Initializes a new instance of the PdfDateTimeField class with PdfFont.

public PdfDateTimeField(PdfFont font)

Parameters

font PdfFont

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)
See Also

PdfDateTimeField(PdfFont, RectangleF)

Initializes a new instance of the PdfDateTimeField class with PdfFont and rectangle bounds

public PdfDateTimeField(PdfFont font, RectangleF bounds)

Parameters

font PdfFont

A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.

bounds RectangleF

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)
See Also

PdfDateTimeField(PdfFont, PdfBrush)

Initializes a new instance of the PdfDateTimeField class with PdfFont and PdfBrush.

public PdfDateTimeField(PdfFont font, PdfBrush brush)

Parameters

font PdfFont

A PdfFont object that specifies the font attributes (the family name, the size, and the style of the font) to use.

brush PdfBrush

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)
See Also

Properties

DateFormatString

Gets or sets the date format string.

public string DateFormatString { get; set; }

Property Value

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)
See Also

Methods

GetValue(PdfGraphics)

Get the value of the field at the specified graphics.

protected override string GetValue(PdfGraphics graphics)

Parameters

graphics PdfGraphics

The graphics.

Returns

string

value

See Also

See Also