Dynamic Field Calculation Totals not Updating When New Values Set #4129
Unanswered
cmiglioreTM
asked this question in
Looking for help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I am trying to do?
I am trying to fill the number fields in a table and have the totals update to reflect the new values.
Description
Hello, I have a pdf template containing a table on the second page that calculates the sum of the rows and displays them.
When I change the value in my script the totals do not reflect this new value when the page is opened. However if I modify any field (checking a checkbox or changing a row for example) the values will recalculate and update correctly.
I found this similar discussion that matches my issue and when I tried the example I received the same results. #1763
The resolution was it was patched in an update but that was 2 years ago and I selected a more recent version.
Sample
AFE Form Table.pdf
(sorry I could not get the code field formatting to work)
import pymupdf
doc = pymupdf.open("AFE Form Table).pdf")
page = doc.load_page(1)
for field in page.widgets():
if field.field_name == "ORIGINAL AMOUNTRow2":
field.field_value = '200.00'
field.update()
print(field.field_value)
if field.field_name == "ORIGINAL AMOUNTRow3":
field.field_value = '100.00'
field.update()
print(field.field_value)
if field.field_name == "AMENDED AMOUNTRow3":
field.field_value = '50.00'
field.update()
print(field.field_value)
#doc.reload_page(page)
page.refresh()
doc.save("test2_result.pdf")
doc.close()
Specs
OS: Windows 10
Python: 3.10
PyMuPDF: 1.24.14
Expectation
Actual results
Beta Was this translation helpful? Give feedback.
All reactions