-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Support qualified names in update_page_form_field_values #1695
Conversation
8d5afe3
to
357f48d
Compare
@xi, |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1695 +/- ##
==========================================
- Coverage 92.54% 92.50% -0.04%
==========================================
Files 34 34
Lines 6502 6512 +10
Branches 1282 1286 +4
==========================================
+ Hits 6017 6024 +7
- Misses 315 316 +1
- Partials 170 172 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Thank you for your contribution @xi 🙏 To be honest, I'm also always struggling with the form-stuff. It might take a while until I decided on how to continue with this PR. Any input (e.g. @pubpub-zz / @MasterOdin / others who know more about PDF) is very welcome :-) |
I added a comment about earlier and for me this is good. |
@xi |
Co-authored-by: Martin Thoma <info@martin-thoma.de>
I don't think I know enough to create a minimal PDF that demonstrates this issue. Can someone please help out? |
@xi
My dev environment is not available for the moment to finalize the code. Can you do it please |
@pubpub-zz thanks for the head start. I tried to fill in the gaps in bc0458d. |
Thank you for your contribution @xi 🙏 It will be in If you want, I can add you to the contributors: https://pypdf.readthedocs.io/en/latest/meta/CONTRIBUTORS.html Just let me know which name I should use / what I should link to :-) |
New Features (ENH) - Extend PdfWriter.append() to PageObjects (#1704) - Support qualified names in update_page_form_field_values (#1695) Robustness (ROB) - Tolerate streams without length field (#1717) - Accept DictionaryObject in /D of NamedDestination (#1720) - Widths def in cmap calls IndirectObject (#1719)
PDF forms often use names like "A.1", "A.2", "B.1", "B.2", … for the fields. However, the
.
has a special meaning, so this creates a hierarchy instead.It was impossible to fill those individual fields with
update_page_form_field_values()
:This change makes
update_page_form_field_values()
to also check for qualified field names.See also #545
@hchillon took a different approach in #545. Unfortunately I don't know enough about PDF to fully understand what they did there. This simple approach worked well for my usecase.
I copied
_get_qualified_field_name()
from thePdfReader
class. Should this be moved to a utility module so it can be shared in both classes? Where would that be?