We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add the different check mark style in checkbox field ?

Platform: WPF |
Control: PDF
Tags: pdf, formfilling

Check Box Field

We can create the check box field using PdfCheckBoxField Class.

Please refer the below code snippet for adding the check box field in new Pdf document.

C#

//Create a new PDF document.
PdfDocument document = new PdfDocument();
 
//Add a new page to PDF document.
PdfPage page = document.Pages.Add();
 
//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
 
//Set check box properties.
checkBoxField.ToolTip = "Check Box";
checkBoxField.Bounds = new RectangleF(0, 20, 10, 10);
 
//Add the form field to the document.
document.Form.Fields.Add(checkBoxField);

 

Checkmark Style

We can add different checkmark styles using PdfCheckBoxStyle enum. Checkmark size is depending on the check box field. Please refer the following code snippet.

C#

//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
 
//Set Check box properties
checkBoxField.Bounds = new RectangleF (50, 230, 8, 8);checkBoxField.Style = PdfCheckBoxStyle.Cross;

 

Please find the different checkmark styles for the check box field from PdfCheckBoxStyle enum.

C#

//Create Check Box field.
PdfCheckBoxField checkBoxField = new PdfCheckBoxField(page, "CheckBox");
 
//Set Check box field style
checkBoxField.Style = PdfCheckBoxStyle.Check;
checkBoxField.Style = PdfCheckBoxStyle.Circle;
checkBoxField.Style = PdfCheckBoxStyle.Cross;
checkBoxField.Style = PdfCheckBoxStyle.Diamond;
checkBoxField.Style = PdfCheckBoxStyle.Square;
checkBoxField.Style = PdfCheckBoxStyle.Star;

 

For example, one check mark style is added to Check Box field can be shown in below code snippet.

C#

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
 
//Add a page.
PdfPage page = doc.Pages.Add();
 
PdfForm form = doc.Form;
 
page.Graphics.DrawString("Qualification:", new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Bold), PdfBrushes.Black, new PointF(50, 100));
 
//Create Check box field
PdfCheckBoxField checkField = new PdfCheckBoxField(page, "UG");
 
//Set Check box properties
checkField.Bounds = new RectangleF(50, 130, 8, 8);
checkField.Style = PdfCheckBoxStyle.Cross;
 
page.Graphics.DrawString("UG", new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Italic), PdfBrushes.Black, new PointF(80, 130));
 
//Create Check box field
PdfCheckBoxField checkField1 = new PdfCheckBoxField(page, "PG");
 
//Set Check box properties
checkField1.Bounds = new RectangleF(50, 170, 8, 8);
checkField1.Style = PdfCheckBoxStyle.Cross;
 
page.Graphics.DrawString("PG", new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Italic), PdfBrushes.Black, new PointF(80, 170));
 
//Add the form field to the document
form.Fields.Add(checkField);
form.Fields.Add(checkField1);

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile