pdftract/crates
jedarden 09428e76f3 feat(pdftract-5w6i): implement AcroForm field walker with recursive walk and dot-joined names
Implements Phase 7.4.1: AcroForm field walker (recursive /Fields + dot-joined names).

## Changes

- Create `crates/pdftract-core/src/forms/mod.rs` module with:
  - `AcroFieldType` enum (Tx, Btn, Ch, Sig, Other)
  - `AcroFormField` struct with full field metadata
  - `walk_acroform_fields()` public API function
  - Recursive DFS traversal with /FT, /V, /DV, /Ff inheritance
  - Widget annotation to page index resolution
  - Cycle detection via visited set
  - Name collision handling (keep last, emit diagnostic)
  - Choice field option extraction for Ch fields

- Update `lib.rs` to export forms module and types

## Implementation Details

- Entry point: `/Catalog /AcroForm /Fields` array
- Dot-joined names: Concatenate `/T` values with "." separator
- Inheritance: `/FT`, `/V`, `/DV`, `/Ff` from parent to child
- Page resolution: Search page `/Annots` arrays for widget annotations
- Cycle detection: `visited` HashSet prevents infinite loops on malformed PDFs
- Name collisions: Track emitted names, keep last on duplicate

## Tests

All 15 unit tests pass:
- Flat 3 fields extraction
- Nested 2-level hierarchy with dot-joined names
- /FT inheritance from parent to child
- /FT override by child
- /Ff (flags) inheritance
- Empty /T segment handling
- Choice field /Opt array parsing
- All field types (Tx, Btn, Ch, Sig)
- Flag accessor methods (is_read_only, is_required, etc.)
- Button field is_checked() method

Closes: pdftract-5w6i

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 05:31:51 -04:00
..
pdftract-cer-diff docs(pdftract-aawrz): add LICENSE-MIT and LICENSE-APACHE files 2026-05-23 10:36:28 -04:00
pdftract-cli feat(pdftract-jmh6w): implement rayon+tokio concurrency bridge 2026-05-24 05:23:20 -04:00
pdftract-core feat(pdftract-5w6i): implement AcroForm field walker with recursive walk and dot-joined names 2026-05-24 05:31:51 -04:00
pdftract-libpdftract feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
pdftract-py docs(pdftract-aawrz): add LICENSE-MIT and LICENSE-APACHE files 2026-05-23 10:36:28 -04:00