I am trying to fill pdf XFA form (pdf attached) using below Spire.Pdf but my code is not updating datetime field rest all fields has been updated. Can anyone help to fill my pdf form dynamically using c#?
case "form1[0].DDEEInput[0].EaxmCompletedDate[0]":
XfaDateTimeField xfSCompleteDate = xfaField as XfaDateTimeField;
xfSCompleteDate.Value ="12/05/2020";
break;


Amy Zhao22 reputationPosted Dec 7, 2020, 10:16 PM EST
Ameer Shaik141 reputationPosted Dec 7, 2020, 10:42 PM EST
Ameer Shaik141 reputationPosted Dec 8, 2020, 7:09 PM EST
Amy Zhao22 reputationPosted Dec 8, 2020, 8:51 PM EST
Farhan Yazdani23 reputationPosted Sep 12, 2023, 2:23 AM EDT
Hey, Ameer bhai how would have you overcome this datefiled issue can you tell me
Saravanan GanesanRank #153 · 15.1K reputationPosted Sep 24, 2023, 1:18 PM EDT
To set a value for an XFA DateTime field using Spire.Pdf in C#, you should use the
XfaDateTimeField.XfaValueproperty instead ofValue. Here's the corrected code:case "form1[0].DDEEInput[0].EaxmCompletedDate[0]":
XfaDateTimeField xfSCompleteDate = xfaField as XfaDateTimeField;
xfSCompleteDate.XfaValue = "12/05/2020";
break;
Using
XfaValueshould correctly set the date in your XFA DateTime field.Marvin ReidRank #1,963 · 746 reputationPosted Oct 24, 2023, 4:37 PM EDT
A solution you can investigate is using the PDFFormField class which would allow you to supply such a value to an existing field. Here is a sample you can test with:
static List EditFormFields(List editedFields) { foreach (var field in editedFields) { if (field.ContentType == PDFFormField.ContentTypeUnrestrained) { field.Contents = new List { "Input String" }; } } return editedFields; }https://www.leadtools.com/help/sdk/tutorials/dotnet-console-parse-edit-and-save-pdf-form-fields.html