Open mschlachter-via opened 1 year ago
When you are cloning the document you are re organizing the internal structure of the document and the signature is broken (an alert is displayed with acrobat reader)
The solution is to remove the signature: the easiest way is to delete the full "/Perms" dictionary:
del w._root_object["/Perms"]
after that you still get an alert saying that you are working on a copy but the calculations are working
I propose to convert it into a discussion to keep the trick visible for other users
@mschlachter-via can you confirm my proposal?
@mschlachter-via +1?
@pubpub-zz I am okay with your proposal to convert to a discussion
I tried your solution and it worked to fix the calculated field but it caused two other problems when the document was opened in Acrobat Reader:
writer.update_page_form_field_values(…)
were all reverted to their default values
When passing pdf files with calculated form fields through pypdf, the calculated fields are no longer updated based on the fields that they depend on.
E.g. If the following file is opened in Acrobat Reader (doesn't seem to work in most other pdf viewers) then the total column at the bottom of the pdf is updated based on the sum of the cost values in the line items of the document: https://static.e-publishing.af.mil/production/1/af_a4/form/af3555/af3555.pdf
However, passing the pdf document through pypdf (even without making any changes) breaks this calculated total field.
Environment
Code + PDF
This is a minimal, complete example that shows the issue:
https://static.e-publishing.af.mil/production/1/af_a4/form/af3555/af3555.pdf