Fillable forms visibility issue

New Here ,
Apr 02, 2022 Apr 02, 2022

Copy link to clipboard

Copied

I am attempting to use automation to fill out an IRS form 941.   I can do it will Excel which allows me to emulate key strokes when I have the form open in Acrobat Reader.  Can save as and the completed form can be opened, viewed, edited and saved.  I wanted a more deliberate way to do it and created a Python application following a paradigm suggested by several web postings including publishing in a conference journal.  All of these suggested setting a NeedAppearances = True in the AcroFrom Annotation section of the dictionary.  It was said this was required to make the filled out form viewable.  However my code was successful in populating the form as I wrote a companion script to read the form after it was saved with a new name.  Howver when this form file is open with Acrobat Reader,  it is blank on the screen and also when I click on a cell I get a pop up saying the form cannot be saved, only printed.  I also tried may scripts to open and immediately close the form to a new name and same problems even though nothing was altered.   Why a different behavior when saving with a Python script versus what I can do manually in Acrobat Reader?

TOPICS
PDF forms

Views

54

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2022 Apr 03, 2022

Copy link to clipboard

Copied

Your Python script is, I assume, not using Adobe technology in any way. I believe this is probably an "XFA" form, almost obsolete. You can't use scripts made for regular PDF forms. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 04, 2022 Apr 04, 2022

Copy link to clipboard

Copied

LATEST

Not sure that is true.  The Python script works perfectly in regard to substitution into blank fields.  So the underlying AcroForm dictionary is being utilized and the script works without errors.  As I noted I can save the file and reopen with a new read and I can see the values from the substituted fields in my script.  The issue is that after using Python,  if I open the saved file with Acrobat Reader the fields do not display.  This is a known issue as documented in several references including this from a published report.

NeedAppearances property in the interactive form dictionary, AcroForm (See § 12.7.2) needs to be set, without this, the fields are updated but will not necessarily display. To remedy this, the following code snippet can be used.
              pdf.Root.AcroForm.update(PdfDict(NeedAppearances=PdfObject('true')))

 

This is in my code but does not affect the behavior  of the substituted form when reeopend. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines