Class PdfCheckBoxField
Represents check box field in the PDF form.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfCheckBoxField : PdfCheckFieldBase, IPdfWrapper, INotifyPropertyChanged
Remarks
This PdfButtonField class is used to add the check box field to the PDF form. Please refer the UG documentation link https://help.syncfusion.com/file-formats/pdf/working-with-forms#adding-the-check-box-field for more details.
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)
Constructors
PdfCheckBoxField(PdfPageBase, String)
Initializes a new instance of the PdfCheckBoxField class with the specific page and name.
Declaration
public PdfCheckBoxField(PdfPageBase page, string name)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The page where the fields should be placed. |
System.String | name | 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.
Declaration
public bool Checked { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
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.
Declaration
protected override void DrawAppearance()
Overrides
Implements
System.ComponentModel.INotifyPropertyChanged