DateEdit in PDF-Document

Hello,

is there a way to insert a DateEdit (FormField) for a date value (with right formatting and input validation)?

Thanks Henry

@HenryE

Thanks for contacting support.

In order to apply DateTime Validation, you can achieve this by adding JavaScript action for TextBoxField. Please check following code snippet where I have created a sample text box with date validation. For your reference, I have also attached an output, generated by below code snippet.

Document pdfDocument = new Document();
pdfDocument.Pages.Add();
TextBoxField tbf = new TextBoxField(pdfDocument.Pages[1], new Rectangle(10, 800, 200, 750));
tbf.Characteristics.Background = Color.Cyan;
PdfAction action = new JavascriptAction("AFDate_FormatEx(\"mm/dd/yyyy\");");
tbf.Actions.OnValidate = action;
pdfDocument.Form.Add(tbf, 1);
pdfDocument.Save(dataDir + "OutputTextBox_DateFormat.pdf");

OutputTextBox_DateFormat.pdf (2.2 KB)

In case of any further assistance, please feel free to contact us.


Best Regards,
Asad Ali

Thank you! Its seems, there is no special Edit like a DateTimepicker. Correct?

@HenryE

Thanks for writing back.

We have logged a feature request as PDFNET-43061 in our issue tracking system for the DateTimePicker Type of form field. Our product team will further investigate the feasibility of the feature and as soon as we have some definite updates in this regard, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.