SuffolkLITLab / form-explorer

A set of tools for exploring the connections between blank and historic court forms.
https://suffolklitlab.org/form-explorer/
2 stars 0 forks source link

Added ability to add fields to an existing PDF (not used yet) #47

Closed BryceStevenWilley closed 2 years ago

BryceStevenWilley commented 2 years ago

Address the first part of https://github.com/SuffolkLITLab/docassemble-ALWeaver/issues/299, the "Adding AcroForm automatically".

A few key limitations:

BryceStevenWilley commented 2 years ago

Got something more complete now: given a PDF, we iterate through all pages, trying to find long-ish horizontal lines that don't run up against any vertical lines. It gives descent results on this PDF, with the except of some aesthetic lines at the bottom that are detected as fields. Bringing in some sort of "label to the right or above" would help with that I think. Probably over fit this one particular example, but we'll see what the other downsides are pretty quickly probably.

The PDF with no fields:

Screenshot from 2022-01-06 17-31-59

The PDF with added fields:

Screenshot from 2022-01-06 17-31-49

Also added a bunch of options for other fields that we can make: choice, listboxes, radio, checkbox, etc. Radio and checkbox are likely to be auto-detected, but choices / listboxes need semantic knowledge of things.

Probably ready for a closer look @nonprofittechy, and I'll merge after this. Sorry, should have marked as draft yesterday when it was still a WIP.