fix(pdf): extract AcroForm field values, not just drawn page text

↗ view on GitHub · terpstra-209 · 2026-08-26 · cf0b9277

extractPdfText only read page.getTextContent(), which is content-stream
text - it never sees a filled-but-unflattened PDF form, since the values
live in annotation field data (fieldName/fieldValue), not on the page
itself. A PDF viewer that fills a form without flattening it (e.g. macOS
Preview) produces exactly this: pdftotext reads the field values, but
Mike's extractor returned the page as if it were blank, regardless of
which LLM read it downstream.

Now also read page.getAnnotations() per page and append any non-empty
field values as a `[Page N form fields]` block. Annotation reads are
wrapped in their own try/catch so one page's failure doesn't blank out
already-extracted text for the rest of the document.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Repository terpstra-209/mike
Author terpstra-209 <261108509+terpstra-209@users.noreply.github.com>
Authored
Committed
Parents 68719b5c
Stats 2 files changed , +72 , -3
Part of Extract filled PDF form fields

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-cf0b9277.md from inside the repo you want the change in.

⬇ Download capture-commit-cf0b9277.md