Table of Contents

Class PdfXfaDocument

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

Represents the XFA document

public class PdfXfaDocument : ICloneable
Inheritance
PdfXfaDocument
Implements
Inherited Members

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Constructors

PdfXfaDocument()

Initialize a new instance of the PdfXfaDocument class.

public PdfXfaDocument()

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Properties

FormName

Gets or sets the form name.

public string FormName { get; set; }

Property Value

string

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Set form name.
document.FormName = "topmostform";
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Set form name.
document.FormName = "topmostform"
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

PageSettings

Gets or set page settings.

public PdfXfaPageSettings PageSettings { get; set; }

Property Value

PdfXfaPageSettings

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new PDF XFA page settings instance.
PdfXfaPageSettings settings = new PdfXfaPageSettings();
//Set margin.
settings.Margins.All = 40;
//Set page orientation.
settings.PageOrientation = PdfXfaPageOrientation.Landscape;
//Set page size.
settings.PageSize = new SizeF(new SizeF(500, 700));
//Set page settings to document.
document.PageSettings = settings;
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new PDF XFA page settings instance.
Dim settings As New PdfXfaPageSettings()
'Set margin.
settings.Margins.All = 40
'Set page orientation.
settings.PageOrientation = PdfXfaPageOrientation.Landscape
'Set page size.
settings.PageSize = New SizeF(New SizeF(500, 700))
'Set page settings to document.
document.PageSettings = settings
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Pages

Get the XFA page

public PdfXfaPageCollection Pages { get; }

Property Value

PdfXfaPageCollection

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage page = document.Pages.Add();
//Set form name.
document.FormName = "topmostform";
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim page As PdfXfaPage = document.Pages.Add()
'Set form name.
document.FormName = "topmostform"
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

XfaForm

Gets or sets the XFA form

public PdfXfaForm XfaForm { get; set; }

Property Value

PdfXfaForm

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Methods

Clone()

Clone

public object Clone()

Returns

object

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Clone the document.
PdfXfaDocument cDocument = document.Clone() as PdfXfaDocument;
//Save the document           
cDocument.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
cDocument.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Clone the document.
PdfXfaDocument cDocument = TryCast(document.Clone(), PdfXfaDocument)
'Save the document           
cDocument.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
cDocument.Close()

Close()

Close the document

public void Close()

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
//Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
'Save the document           
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Save(Stream, PdfXfaType)

save the document

public void Save(Stream stream, PdfXfaType type)

Parameters

stream Stream

The output stream.

type PdfXfaType

The xfa form type.

Examples

//Create a new XFA document 
PdfXfaDocument document = new PdfXfaDocument();
//Create a new XFA form
PdfXfaForm form = new PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595);
//Create a new XFA Field
PdfXfaDateTimeField field = new PdfXfaDateTimeField("dateTime1", new SizeF(100, 30));
//Set the default value
field.Value = DateTime.Now;
//Add the field to the form
form.Fields.Add(field);
document.XfaForm = form;
MemoryStream stream = new MemoryStream();
//Save the document           
document.Save(stream, PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new XFA document 
Dim document As New PdfXfaDocument()
'Create a new XFA form
Dim form As New PdfXfaForm(PdfXfaFlowDirection.Horizontal, 595)
'Create a new XFA Field
Dim field As New PdfXfaDateTimeField("dateTime1", New SizeF(100, 30))
'Set the default value
field.Value = DateTime.Now
'Add the field to the form
form.Fields.Add(field)
document.XfaForm = form
Dim stream As MemoryStream = New MemoryStream()
'Save the document           
document.Save(stream, PdfXfaType.Dynamic)
'Close the document
document.Close()