We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TextBoxField format property set to Date

Date_Property.PNG (2.8 KB)

I have a TextBoxField object where I want to set the field’s format category as Date as shown in screenshot. I went through api associated with TextBoxField but not able to find that can set the field’s format. So can you please guide me, how that would be possible.

Also,when I do parse, how would I read the field’s format property ?

This is what I want and I have added comment there as well.

I want to achieve this as on upload side by format type I know how to take care of Date fields. I want only this solution and no other hack as it is supported by PDF.

Darshit Patel


You can use JavaScript Actions in order to apply validation on TextBoxField by following code snippet:

Format TextBoxField for Date Value

Document doc = new Document();
Page page = doc.getPages().add();
TextBoxField tbf = new TextBoxField(page, new Rectangle(10, 800, 200, 750));
PdfAction action = new JavascriptAction("AFDate_FormatEx(\"mm/dd/yyyy\");");
doc.getForm().add(tbf, 1);
doc.save(dataDir + "DateFormat.pdf");

In case it does not help, please let us know. We will further proceed to assist you accordingly.


It is not working as per our requirement and somehow we have to set format property to Date.

If there is no Aspose PDF Java api to set the format property to Date, can you provide some way to edit PostScript within PDF that allow us to change the format property to Date.

If you have any other idea to do it, please share it. (Note: JavaScript does not work.)

Darshit Patel


We have tested the scenario in our environment and JavaScript was working in the output PDF document generated on our side.

DateFormat.pdf (2.2 KB)

Would you kindly explain what issues you are facing regarding JavaScript execution at your end? Also, please share a sample desired output PDF that you want to generate using the API. We will further proceed to assist you accordingly.