Table of Contents

Class PdfXfaCheckBoxField

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

Represents checkbox field of the XFA form.

public class PdfXfaCheckBoxField : PdfXfaStyledField
Inheritance
PdfXfaCheckBoxField
Inherited Members

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Constructors

PdfXfaCheckBoxField(string, SizeF)

Initializes a new instance of the PdfXfaCheckBoxField class.

public PdfXfaCheckBoxField(string name, SizeF size)

Parameters

name string

The name of the check box field.

size SizeF

The size of the check box field.

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

PdfXfaCheckBoxField(string, SizeF, bool)

Initializes a new instance of the PdfXfaCheckBoxField class.

public PdfXfaCheckBoxField(string name, SizeF size, bool isChecked)

Parameters

name string

The name of the check box field

size SizeF

The size of the check box field

isChecked bool

The checked state of the check box

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30), true);
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross; 
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30), True)
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross       
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

PdfXfaCheckBoxField(string, float, float)

Initializes a new instance of the PdfXfaCheckBoxField class.

public PdfXfaCheckBoxField(string name, float width, float height)

Parameters

name string

Name of the check box field.

width float

Check box field width.

height float

Check box field height.

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", 100, 30);
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", 100, 30)
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

PdfXfaCheckBoxField(string, float, float, bool)

Initializes a new instance of the PdfXfaCheckBoxField class.

public PdfXfaCheckBoxField(string name, float width, float height, bool isChecked)

Parameters

name string

Name of the check box field.

width float

Check box field width.

height float

Check box field height.

isChecked bool

Checked state of the field.

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", 100, 30, true);
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross; 
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", 100, 30, True)
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross      
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Properties

Caption

Gets or sets the caption of the field

public PdfXfaCaption Caption { get; set; }

Property Value

PdfXfaCaption

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

CheckBoxAppearance

Gets or sets the appearance of the check box field

public PdfXfaCheckBoxAppearance CheckBoxAppearance { get; set; }

Property Value

PdfXfaCheckBoxAppearance

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

CheckBoxSize

Gets or sets the check box size

public float CheckBoxSize { get; set; }

Property Value

float

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

CheckedStyle

Gets or sets the checked Style of the check box field

public PdfXfaCheckedStyle CheckedStyle { get; set; }

Property Value

PdfXfaCheckedStyle

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

IsChecked

Gets or sets a value indicating whether this is checked or not

public bool IsChecked { get; set; }

Property Value

bool

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);          
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()

Methods

Clone()

Creates a new object that is a copy of the current instance.

public object Clone()

Returns

object

The copy of the new object for this instance.

Examples

//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm xfaForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
//Set margin of the form.            
xfaForm.Margins.All = 10;
//Create new XFA check box field.
PdfXfaCheckBoxField field = new PdfXfaCheckBoxField("check1", new SizeF(100, 30));
//Set caption.
field.Caption.Text = "CheckBox";         
//Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square;
//Set the check box size.
field.CheckBoxSize = 10;
//Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross;  
//Set the check box checked state.         
field.IsChecked = true;
//Add the field to form.
xfaForm.Fields.Add(field);    
//Clone the check box field.
xfaForm.Fields.Add(field.Clone() as PdfXfaCheckBoxField);  
document.XfaForm = xfaForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim xfaForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
'Set margin of the form.            
xfaForm.Margins.All = 10
'Create new XFA check box field.
Dim field As New PdfXfaCheckBoxField("check1", New SizeF(100, 30))
'Set caption.
field.Caption.Text = "CheckBox"
'Set checkbox appearance.
field.CheckBoxAppearance = PdfXfaCheckBoxAppearance.Square
'Set the check box size.
field.CheckBoxSize = 10
'Set the checked style.
field.CheckedStyle = PdfXfaCheckedStyle.Cross
'Set the check box checked state.         
field.IsChecked = True
'Add the field to form.
xfaForm.Fields.Add(field)
'Clone the check box field.
xfaForm.Fields.Add(TryCast(field.Clone(), PdfXfaCheckBoxField))  
document.XfaForm = xfaForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()