Issues related to PDF that utilizes XFA

Hello, I am running into an issue while populating a PDF file that is XFA. I am using UiPath to run a C# script that reads the PDF, pulls the XFA form from it, and then updates fields that I need updated via the script. The package the bot relies on to execute the script is itext 7. This works perfect except for one field. The field doesn’t seem any different than any of the other fields that need to be populated. The script doesn’t throw an error or anything. The PDF just doesn’t show a value when you open it for that specific field.

Has anyone ever experienced issues while trying to populate fields where for some odd reason 1 of the fields just never updated? I even checked the XML of the PDF. The field has the value in it, but when you open the PDF the field shows nothing.

@Michael_Gable

Is that a check box field or somthing else?

Try first filling some data manually amd get the fields and check how the value is populated…

Generally we might see this for ckwck box fields or selection fields…

Some check boxes are checked when you assign a value to the first fields like the index number of the field that is to be checked…

Some check boxes work when the value of 1 is set for the specific field…

Similarly for text fields also …they might have limits and if it crosses might not fill…

So please check these details accordingly.better would be to fill the data manually and perform a get …so that you know how the fields are set

Hope this helps

Cheers

@Anil_G - this is not a check box field. It is a date field, but not a typical date field with a calendar pop out or anything like that. It appears as a text field. I pulled the DOM doc of the PDF and saw that there were functions built in to check the format of the field. It should be entered as MM/dd/yyyy. I do this manually and it works. I do this via the script and it does not.

I even went as far as removing the functions that validate the field and set the edited DOM doc to the PDF. I manually confirmed that the validation was no longer checking the field. I could enter whatever value into it. But when the script ran, it still failed to show the value in the PDF.

@Michael_Gable

Did you try getting the data from the pdf field after you filled manually?

try getting it …may be it is stored in a different format as mentioned

cheers

@Anil_G - yes, I tried that too. As I mentioned before, the value is shown in the XML but not in the PDF. In the XML it appears without the slashes. So MMddyyyy. I tried to have the script enter the value that way as well, but it did not work. I tried a bunch of different date formats, none showed in the PDF.

@Michael_Gable

Looks like similar issue

Did you happen to check this

cheers

@Anil_G - I haven’t seen that particular post, but doesn’t seem like it will help me since I need to utilize itext 7. That is related to itext 5, which does not work with the new ReFramework. I will say though that I already tried what the article mentioned where I update the XML via the script and then write that to the PDF instead of doing individual field updates with the new itext 7.

I can confirm though that other date fields work without any issue in the PDF via the script. There is a field that manually has a pop up calendar. I can enter a date through the script and the PDF shows the value when I open it for that field.

1 Like

Hi @Michael_Gable ,

Could you check with the below Component :

We would require to use a Windows-Legacy project for it to be used.

Let us know if you can test this in a Windows-Legacy project properly and able to get the required output or fill the form properly.

@supermanPunch - Thanks for the suggestion! Unfortunately that package only works for pure PDF Forms. My PDF is considered an XFA form, so it does not recognize the fields in it while trying out the activities.

1 Like