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
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/NET/Working-with-forms.md
+88Lines changed: 88 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4504,6 +4504,94 @@ document.Close(True)
4504
4504
4505
4505
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Forms/Export_checkbox_values/.NET).
4506
4506
4507
+
## Add a date field to a PDF form
4508
+
4509
+
This section explains how to add a date text box field to a PDF form using the Syncfusion PDF library. The field is prefilled with a sample date and uses JavaScript-based formatting to enforce the date format, validate input, and automatically format user entries.
4510
+
4511
+
The following code example illustrates how to add a date field to a PDF form.
4512
+
4513
+
{% tabs %}
4514
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
4515
+
4516
+
using Syncfusion.Drawing;
4517
+
using Syncfusion.Pdf;
4518
+
using Syncfusion.Pdf.Interactive;
4519
+
4520
+
// Create a new PDF document
4521
+
using (PdfDocument pdfDocument = new PdfDocument())
4522
+
{
4523
+
// Add a new page to the PDF document
4524
+
PdfPage pdfPage = pdfDocument.Pages.Add();
4525
+
// Create a text box field for entering the name
4526
+
PdfTextBoxField nameField = new PdfTextBoxField(pdfPage, "DateField");
4527
+
nameField.Bounds = new RectangleF(10, 40, 200, 20);
4528
+
nameField.ToolTip = "Date";
4529
+
nameField.Text = "12/01/1995";
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\")");
You can download a complete working sample from GitHub.
4594
+
4507
4595
## Unified radio button selection
4508
4596
4509
4597
The essential<sup>®</sup> PDF allows radio buttons within the same group that have identical export values to be selected or deselected simultaneously.
0 commit comments