You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4524,13 +4524,13 @@ using (PdfDocument pdfDocument = new PdfDocument())
4524
4524
PdfPage pdfPage = pdfDocument.Pages.Add();
4525
4525
// Create a text box field for entering the name
4526
4526
PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "DateField");
4527
-
nameField.Bounds = new RectangleF(10, 40, 200, 20);
4527
+
nameField.Bounds = new RectangleF(10, 40, 70, 20);
4528
4528
nameField.ToolTip = "Date";
4529
4529
nameField.Text = "12/01/1995";
4530
4530
//Set the scriptAction to submitButton
4531
-
nameField.Actions.KeyPressed = new PdfJavaScriptAction("AFDate_KeystrokeEx(\"m/d/yy\")");
4532
-
nameField.Actions.Format = new PdfJavaScriptAction("AFDate_FormatEx(\"m/d/yy\")");
4533
-
nameField.Actions.Validate = new PdfJavaScriptAction("AFDate_Validate(\"m/d/yy\")");
4531
+
nameField.Actions.KeyPressed = new PdfJavaScriptAction("AFDate_KeystrokeEx(\"mm/dd/yyyy\")");
4532
+
nameField.Actions.Format = new PdfJavaScriptAction("AFDate_FormatEx(\"mm/dd/yyyy\")");
4533
+
nameField.Actions.Validate = new PdfJavaScriptAction("AFDate_Validate(\"mm/dd/yyyy\")");
4534
4534
// Add the field to the form
4535
4535
pdfDocument.Form.Fields.Add(nameField);
4536
4536
// Save the PDF document
@@ -4550,13 +4550,13 @@ using (PdfDocument pdfDocument = new PdfDocument())
4550
4550
PdfPage pdfPage = pdfDocument.Pages.Add();
4551
4551
// Create a text box field for entering the name
4552
4552
PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "DateField");
4553
-
nameField.Bounds = new RectangleF(10, 40, 200, 20);
4553
+
nameField.Bounds = new RectangleF(10, 40, 70, 20);
4554
4554
nameField.ToolTip = "Date";
4555
4555
nameField.Text = "12/01/1995";
4556
4556
//Set the scriptAction to submitButton
4557
-
nameField.Actions.KeyPressed = new PdfJavaScriptAction("AFDate_KeystrokeEx(\"m/d/yy\")");
4558
-
nameField.Actions.Format = new PdfJavaScriptAction("AFDate_FormatEx(\"m/d/yy\")");
4559
-
nameField.Actions.Validate = new PdfJavaScriptAction("AFDate_Validate(\"m/d/yy\")");
4557
+
nameField.Actions.KeyPressed = new PdfJavaScriptAction("AFDate_KeystrokeEx(\"mm/dd/yyyy\")");
4558
+
nameField.Actions.Format = new PdfJavaScriptAction("AFDate_FormatEx(\"mm/dd/yyyy\")");
4559
+
nameField.Actions.Validate = new PdfJavaScriptAction("AFDate_Validate(\"mm/dd/yyyy\")");
4560
4560
// Add the field to the form
4561
4561
pdfDocument.Form.Fields.Add(nameField);
4562
4562
// Save the PDF document
@@ -4575,13 +4575,13 @@ Using pdfDocument As New PdfDocument()
4575
4575
Dim pdfPage As PdfPage = pdfDocument.Pages.Add()
4576
4576
' Create a text box field for entering the name
4577
4577
Dim nameField As New PdfTextBoxField(pdfPage, "DateField")
4578
-
nameField.Bounds = New RectangleF(10, 40, 200, 20)
4578
+
nameField.Bounds = New RectangleF(10, 40, 70, 20)
4579
4579
nameField.ToolTip = "Date"
4580
4580
nameField.Text = "12/01/1995"
4581
4581
' Set the scriptAction to submitButton
4582
-
nameField.Actions.KeyPressed = New PdfJavaScriptAction("AFDate_KeystrokeEx(""m/d/yy"")")
4583
-
nameField.Actions.Format = New PdfJavaScriptAction("AFDate_FormatEx(""m/d/yy"")")
4584
-
nameField.Actions.Validate = New PdfJavaScriptAction("AFDate_Validate(""m/d/yy"")")
4582
+
nameField.Actions.KeyPressed = New PdfJavaScriptAction("AFDate_KeystrokeEx(\"mm/dd/yyyy\")")
4583
+
nameField.Actions.Format = New PdfJavaScriptAction("AFDate_FormatEx(\"mm/dd/yyyy\")")
4584
+
nameField.Actions.Validate = New PdfJavaScriptAction("AFDate_Validate(\"mm/dd/yyyy\")")
4585
4585
' Add the field to the form
4586
4586
pdfDocument.Form.Fields.Add(nameField)
4587
4587
' Save the PDF document
@@ -4590,7 +4590,7 @@ End Using
4590
4590
{% endhighlight %}
4591
4591
{% endtabs %}
4592
4592
4593
-
You can download a complete working sample from GitHub.
4593
+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Forms/Add-a-date-field-to-a-PDF/.NET).
0 commit comments