|
5 | 5 | using Syncfusion.Pdf.Graphics;
|
6 | 6 | using Syncfusion.Pdf.Interactive;
|
7 | 7 |
|
8 |
| -//Create a PDF document. |
| 8 | +//Create a PDF document |
9 | 9 | PdfDocument document = new PdfDocument();
|
10 |
| - |
11 |
| -//Add a new page. |
| 10 | +//Add a new page |
12 | 11 | PdfPage page = document.Pages.Add();
|
13 | 12 |
|
14 |
| -//Create a Text box field. |
| 13 | +//Create a Text box field |
15 | 14 | PdfTextBoxField textBoxField = new PdfTextBoxField(page, "FirstName");
|
16 |
| - |
17 |
| -//Set properties to the textbox. |
| 15 | +//Set properties to the textbox |
18 | 16 | textBoxField.BorderColor = new PdfColor(Color.Gray);
|
19 | 17 | textBoxField.BorderStyle = PdfBorderStyle.Beveled;
|
20 | 18 | textBoxField.Bounds = new RectangleF(80, 0, 100, 20);
|
21 | 19 | textBoxField.Text = "First Name";
|
22 | 20 |
|
23 |
| -//Add the form field to the document. |
| 21 | +//Add the form field to the document |
24 | 22 | document.Form.Fields.Add(textBoxField);
|
25 | 23 |
|
26 | 24 | //Create a Button field.
|
27 | 25 | PdfButtonField clearButton = new PdfButtonField(page, "Clear");
|
28 |
| - |
29 |
| -//Set properties to the button field. |
30 | 26 | clearButton.Bounds = new RectangleF(100, 60, 50, 20);
|
31 | 27 | clearButton.ToolTip = "Clear";
|
| 28 | +//Add button field to the form |
32 | 29 | document.Form.Fields.Add(clearButton);
|
33 | 30 |
|
| 31 | +//Create an instance of reset action |
| 32 | +PdfResetAction resetAction = new PdfResetAction(); |
| 33 | +clearButton.Actions.GotFocus = resetAction; |
| 34 | + |
34 | 35 | //Create file stream.
|
35 | 36 | using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
|
36 | 37 | {
|
|
0 commit comments