Skip to content

Commit 254d398

Browse files
committed
964875: Added proper reset action code example.
1 parent 00d3d48 commit 254d398

File tree

1 file changed

+10
-9
lines changed
  • Actions/Reset-form-fields-in-the-PDF-document/.NET/Reset-form-fields-in-the-PDF-document

1 file changed

+10
-9
lines changed

Actions/Reset-form-fields-in-the-PDF-document/.NET/Reset-form-fields-in-the-PDF-document/Program.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,33 @@
55
using Syncfusion.Pdf.Graphics;
66
using Syncfusion.Pdf.Interactive;
77

8-
//Create a PDF document.
8+
//Create a PDF document
99
PdfDocument document = new PdfDocument();
10-
11-
//Add a new page.
10+
//Add a new page
1211
PdfPage page = document.Pages.Add();
1312

14-
//Create a Text box field.
13+
//Create a Text box field
1514
PdfTextBoxField textBoxField = new PdfTextBoxField(page, "FirstName");
16-
17-
//Set properties to the textbox.
15+
//Set properties to the textbox
1816
textBoxField.BorderColor = new PdfColor(Color.Gray);
1917
textBoxField.BorderStyle = PdfBorderStyle.Beveled;
2018
textBoxField.Bounds = new RectangleF(80, 0, 100, 20);
2119
textBoxField.Text = "First Name";
2220

23-
//Add the form field to the document.
21+
//Add the form field to the document
2422
document.Form.Fields.Add(textBoxField);
2523

2624
//Create a Button field.
2725
PdfButtonField clearButton = new PdfButtonField(page, "Clear");
28-
29-
//Set properties to the button field.
3026
clearButton.Bounds = new RectangleF(100, 60, 50, 20);
3127
clearButton.ToolTip = "Clear";
28+
//Add button field to the form
3229
document.Form.Fields.Add(clearButton);
3330

31+
//Create an instance of reset action
32+
PdfResetAction resetAction = new PdfResetAction();
33+
clearButton.Actions.GotFocus = resetAction;
34+
3435
//Create file stream.
3536
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
3637
{

0 commit comments

Comments
 (0)