Repository navigation
feat(pdf): key form fields by their /TU description and skip artifact widgets - #4144
Merged
PeterStaar-IBM merged 2 commits intoNov 12, 2026
Conversation
Contributor
|
✅ DCO Check Passed Thanks @wittjeff, all your commits are properly signed off. 🎉 |
CHECKBOX_* clusters are in TEXT_ELEM_LABELS, so a /Btn widget sitting inside its detected checkbox cluster matched that cluster as its paragraph key container. The option label then appeared twice (as the key and on the nested checkbox child) and the region pointed at a cluster that promotion had already dropped, so assembly emitted it as a stray field_region. Exclude checkbox clusters from key-container candidates; the label rides on the checkbox child only. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Jeff Witt <1848307+wittjeff@users.noreply.github.com>
Stacked on docling-project#4140. Well-Tagged PDF 1.0, the basis of PDF/UA-2, lists a field's /TU entry among the sources of context for a widget (8.10.2.1) and states that the field name (/T) does not contribute. A widget that is not inlined in a paragraph (a FORM-matched or fallback field) now gets a FieldKeyItem with its /TU text, without provenance since it is dictionary metadata rather than page text. Widgets inlined in a paragraph keep the paragraph as their key. FieldItemPrediction records where the key came from (layout or tooltip) so structure-tree labels can be added later without changing the contract. Docs and option text updated: fields are no longer described as keyless. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Jeff Witt <1848307+wittjeff@users.noreply.github.com>
wittjeff
force-pushed
the
feat/acroform-ua2-labels
branch
from
September 3, 2026 15:46
8691352 to
4c198e5
Compare
wittjeff
force-pushed
the
feat/acroform-ua2-labels
branch
2 times, most recently
from
October 6, 2026 14:20
cc3bcc4 to
4c198e5
Compare
2 of 3 tasks
PeterStaar-IBM
merged commit Nov 12, 2026
f9b3d47
into
docling-project:feat/acroform-native-fields
6 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #4140 (base branch
feat/acroform-native-fields, rebased onto 505a96b). Phase 2 of the follow-on proposal in #4143: the smallest docling-only step that aligns the form stage with Well-Tagged PDF 1.0 (the basis of PDF/UA-2) without touching the docling-core schema.Since the first version of this PR, #4140 itself absorbed the zero-size and push-button skips, so those are gone from here. Two commits remain:
1.
fix(acroform): never key a checkbox widget by its own layout cluster (cherry-pickable into #4140)CHECKBOX_SELECTED/CHECKBOX_UNSELECTEDare inTEXT_ELEM_LABELS, so_match_text_containercould pick the checkbox cluster the widget sits in as its "paragraph" key container. The option label then appeared twice (as the key and on the nested checkbox child) and the region'ssource_container_idpointed at a cluster that promotion had already dropped, so assembly emitted a strayfield_region. Checkbox clusters are now excluded from key-container candidates; the label rides on the checkbox child only. The existing checkbox test is tightened to assert a keyless fallback region.2.
feat(pdf): key standalone form fields by their/TUdescriptionWTPDF 8.10.2.1 lists the sources of context for a widget (structure-tree
Lbl, the field'sTU, the widget'sContents) and states that the field name (T) does not contribute. So:key_source="layout", with provenance).FieldKeyItemfrom its/TUwhen present (key_source="tooltip", no provenance, since it is dictionary metadata rather than page text). Nothing is inferred from geometry or from/T.FieldItemPrediction.key_sourcerecords where the key came from so structure-tree labels and/Contentscan be added later without changing the contract.What does not change
Layout prediction handling, region binding, fallback regions, duplicate suppression, reading-order placement, and the
extract_form_fields=Falseno-op are untouched. Document schema unchanged;FieldKeyItemalready exists in docling-core.Tests
tests/test_form_extraction.py: the unit test gives one widget a/TUand asserts the key, its source, and the absence of a bbox through mapping, assembly, and materialization. The pipeline test now asserts two keys onacroform_sample.pdf: the paragraph key (with provenance) for the three inlined checkboxes, andFull legal name(no provenance) for the text field in the page-wide region. The first checkbox also carries a/TUbut is inlined, so the paragraph wins and no second key appears.Docs
Option description,
docs/usage/advanced_options.md, and the packaged usage skill reference no longer describe fields as keyless; they now state the paragraph-then-/TUrule, the nested checkbox child, and the skipped widgets.Base note (2026-10-06)
The same two commits rebased onto
wittjeff/docling:rebase/acroform-native-fields(the fast-forwardable continuation offeat/acroform-native-fieldsoffered on #4140) are kept atwittjeff/docling:feat/acroform-ua2-labels-main. Theretests/test_form_extraction.pyis 6/6 andmake validateis clean against currentmain. This PR branch stays on the current base so its diff remains the two commits; it will be swapped for the rebased branch once #4140 moves.Checklist:
🤖 Generated with Claude Code