Free Support Forum - aspose.com

PDF Form.FillField producing incorrect dates

I am using Aspose.Pdf.Facades.Form.FillFIeld to insert a date (today for example) into a fillable PDF file. When I open the filled PDF, the date is displayed with the year 3918 instead of 2018. I have also seen numbers being formatted incorrectly, though the attached example just shows the date.

Attached is a simple test solution that demonstrates the issue.

DocumentTest.zip (6.8 MB)

@jcapell

Thank you for contacting support.

We have worked with the data shared by you but we have not been able to reproduce it with Aspose.PDF for .NET 18.9.1 in our environment. Would you please ensure using latest version and then share your generated PDF file with us. PDF file generated in our environment has been attached for your kind reference.
myPDF_Filled.pdf

Attached is my version, using the latest version of Aspose.PDF. It looks like you are using different date formatting, so that might be related. I am formatting my date string as “9/26/2018”

This code should put it in the format that is causing my error.

string dateString = DateTime.Now.ToString("MM/dd/yyyy");
form.FillField("ProjectStart", dateString);

myPDF_Filled.pdf (6.9 MB)

@jcapell

We have updated the code in sample application but the problem is still not reproduced. It appears like Date settings on your system are affecting the value. Can you please check your local date settings and format. Moreover, this value is retrieved with System.DateTime class so you may try to print the value with Console.WriteLine statement and test if it is printed fine or not, as this does not appear like an issue with the API.

The following support issue demonstrates the exact same behavior and has been acknowledged as an Aspose bug. Does this help repro it? Or can you give me an update on the related Aspose backlog item ( PDFNET-44080)?

Thanks!

@jcapell

Thank you for elaborating it.

We have not been able to reproduce it with latest version of the API. However, PDFNET-44080 was reproduced with an older version and some environment variables may contributed to reproduction of the problem at that time. About logged ticket, it is currently pending owing to previously logged issues. We have recorded your concerns under the same ticket and will let you know as soon as it will be resolved. We appreciate your patience and comprehension in this regard.

Thank you very much!