Table of Contents

Class PdfLoadedXfaDateTimeField

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

Represents the loaded date time field of the XFA form.

public class PdfLoadedXfaDateTimeField : PdfLoadedXfaStyledField
Inheritance
PdfLoadedXfaDateTimeField
Inherited Members

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded date time field.
PdfLoadedXfaDateTimeField loadedDateTimeField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["dateTimeField[0]"] as PdfLoadedXfaDateTimeField;
//Set the value
loadedDateTimeField.Value = DateTime.Now;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded date time field.
Dim loadedDateTimeField As PdfLoadedXfaDateTimeField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("dateTimeField[0]"), PdfLoadedXfaDateTimeField)
'Set the value           
loadedDateTimeField.Value = Date.Now
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Constructors

PdfLoadedXfaDateTimeField()

public PdfLoadedXfaDateTimeField()

Properties

Format

Get or sets the date field format

public PdfXfaDateTimeFormat Format { get; set; }

Property Value

PdfXfaDateTimeFormat

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded date time field.
PdfLoadedXfaDateTimeField loadedDateTimeField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["dateTimeField[0]"] as PdfLoadedXfaDateTimeField;
//Set the value
loadedDateTimeField.Value = DateTime.Now;
//Get the date time format.
PdfXfaDateTimeFormat format = loadedDateTimeField.Format;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded date time field.
Dim loadedDateTimeField As PdfLoadedXfaDateTimeField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("dateTimeField[0]"), PdfLoadedXfaDateTimeField)
'Set the value           
loadedDateTimeField.Value = Date.Now
'Get the date time format.
Dim format As PdfXfaDateTimeFormat = loadedDateTimeField.Format
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Pattern

Gets or set the date field pattern

public string Pattern { get; set; }

Property Value

string

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded date time field.
PdfLoadedXfaDateTimeField loadedDateTimeField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["dateTimeField[0]"] as PdfLoadedXfaDateTimeField;
//Set the value
loadedDateTimeField.Value = DateTime.Now;
//Set the pattern.
loadedDateTimeField.Pattern = "date{MMMM DD, YYYY}";
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded date time field.
Dim loadedDateTimeField As PdfLoadedXfaDateTimeField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("dateTimeField[0]"), PdfLoadedXfaDateTimeField)
'Set the value           
loadedDateTimeField.Value = Date.Now
'Set the pattern.
loadedDateTimeField.Pattern = "date{MMMM DD, YYYY}"
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Value

Gets or sets the date time

public DateTime Value { get; set; }

Property Value

DateTime

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded date time field.
PdfLoadedXfaDateTimeField loadedDateTimeField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["dateTimeField[0]"] as PdfLoadedXfaDateTimeField;
//Set the value
loadedDateTimeField.Value = DateTime.Now;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded date time field.
Dim loadedDateTimeField As PdfLoadedXfaDateTimeField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("dateTimeField[0]"), PdfLoadedXfaDateTimeField)
'Set the value           
loadedDateTimeField.Value = Date.Now
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Methods

ClearValue()

Clear the DateTime field value. By doing this, the DateTime field will be set to empty.

public void ClearValue()

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded date time field.
PdfLoadedXfaDateTimeField loadedDateTimeField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["dateTimeField[0]"] as PdfLoadedXfaDateTimeField;
//Clear the value
loadedDateTimeField.ClearValue();+        /// //Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded date time field.
Dim loadedDateTimeField As PdfLoadedXfaDateTimeField = TryCast((TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm)).Fields("dateTimeField[0]"), PdfLoadedXfaDateTimeField)
'Clear the value           
loadedDateTimeField.ClearValue()
'Save the document 
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()