-
Notifications
You must be signed in to change notification settings - Fork 6
Form filler service
The Form Filler Service replaces NVRIS. It is integrated into the ksvotes.org Flask app directly, rather than as an external Lambda service. It relies on the FormFiller Python module to do the actual image manipulation.
Each Form requires:
- Base image (PNG file derived from a SOS PDF file). Using the Mac Preview app, exporting the PDF as a PNG at 200 pixels/inch should give a PNG file with dimensions 1700 x 2200, which seems optimal for clarity and size.
- A form definitions JSON file. The definitions should be an array of per-field specifics, including the field name, and X/Y coordinates describing the rectangle the field occupies on the base image. Example:
{
"type" : "draw",
"x1" : 100,
"name" : "id_number",
"y2" : 642,
"y1" : 595,
"x2" : 1616
}
The supported field types are draw
(for text), enclose
for drawing a line around a "select one" set of options, fill
for a box that should be colored in, and circle
(to wrap a perfect circle around an option). The overlay
option is used to place a signature or other image over the top of the base image.
Determining the coordinates is the most time-consuming aspect. There is a helper script in the repo to generate a pseudo form payload for working on coordinates. Example:
% python bin/form-preview /av/ksav1/es
In general, bigger numeric values move the X axis point "right" and bigger Y values move "down".