Table of Contents

Class PdfCheckBoxField

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

Represents check box field in the PDF form.

public class PdfCheckBoxField : PdfCheckFieldBase, INotifyPropertyChanged
Inheritance
PdfCheckBoxField
Implements
Inherited Members

Examples

//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics graphics = page.Graphics;
//Create a check box
PdfCheckBoxField checkBox = new PdfCheckBoxField(page, "C#.NET");   
checkBox.Bounds = new RectangleF(100, 290, 20, 20);
checkBox.HighlightMode = PdfHighlightMode.Push;
checkBox.BorderStyle = PdfBorderStyle.Beveled;
//Set the value for the check box
checkBox.Checked = true;
document.Form.Fields.Add(checkBox);
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim graphics As PdfGraphics = page.Graphics
'Create a check box
Dim checkBox As PdfCheckBoxField = New PdfCheckBoxField(page, "C#.NET") 
checkBox.Bounds = New RectangleF(100, 290, 20, 20)
checkBox.HighlightMode = PdfHighlightMode.Push
checkBox.BorderStyle = PdfBorderStyle.Beveled
'Set the value for the check box
checkBox.Checked = True
document.Form.Fields.Add(checkBox)
document.Save("Form.pdf")
document.Close(True)

Remarks

This PdfButtonField class is used to add the check box field to the PDF form. Please refer the UG docuemntation link for more details.

Constructors

PdfCheckBoxField(PdfPageBase, string)

Initializes a new instance of the PdfCheckBoxField class with the specific page and name.

public PdfCheckBoxField(PdfPageBase page, string name)

Parameters

page PdfPageBase

The page where the fields should be placed.

name string

The name of the check box field.

Examples

//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics graphics = page.Graphics;
//Create a check box
PdfCheckBoxField checkBox = new PdfCheckBoxField(page, "C#.NET");        
checkBox.Bounds = new RectangleF(100, 290, 20, 20);
checkBox.HighlightMode = PdfHighlightMode.Push;
checkBox.BorderStyle = PdfBorderStyle.Beveled;
//Set the value for the check box
checkBox.Checked = true;
document.Form.Fields.Add(checkBox);
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim graphics As PdfGraphics = page.Graphics
'Create a check box
Dim checkBox As PdfCheckBoxField = New PdfCheckBoxField(page, "C#.NET")      
checkBox.Bounds = New RectangleF(100, 290, 20, 20)
checkBox.HighlightMode = PdfHighlightMode.Push
checkBox.BorderStyle = PdfBorderStyle.Beveled
'Set the value for the check box
checkBox.Checked = True
document.Form.Fields.Add(checkBox)
document.Save("Form.pdf")
document.Close(True)
See Also

Properties

Checked

Gets or sets a value indicating whether this PdfCheckBoxField is checked.

public bool Checked { get; set; }

Property Value

bool

true if checked; otherwise, false.

Examples

//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics graphics = page.Graphics;
//Create a check box
PdfCheckBoxField checkBox = new PdfCheckBoxField(page, "C#.NET");
//Set the value for the check box
checkBox.Checked = true;       
checkBox.Bounds = new RectangleF(100, 290, 20, 20);
checkBox.HighlightMode = PdfHighlightMode.Push;
checkBox.BorderStyle = PdfBorderStyle.Beveled;
//Set the value for the check box
checkBox.Checked = true;
document.Form.Fields.Add(checkBox);
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim graphics As PdfGraphics = page.Graphics
'Create a check box
Dim checkBox As PdfCheckBoxField = New PdfCheckBoxField(page, "C#.NET")
'Set the value for the check box
checkBox.Checked = True
checkBox.Bounds = New RectangleF(100, 290, 20, 20)
checkBox.HighlightMode = PdfHighlightMode.Push
checkBox.BorderStyle = PdfBorderStyle.Beveled
'Set the value for the check box
checkBox.Checked = True
document.Form.Fields.Add(checkBox)
document.Save("Form.pdf")
document.Close(True)
See Also

Methods

DrawAppearance()

Draws the appearance of the field.

protected override void DrawAppearance()
See Also

See Also