JustFill PDF Form Automation

v0.4.10
io.github.mrmaciej1/justfill-pdf-forms Checked 1 day ago Published 3 months ago

Detect, review and fill existing PDF forms from JSON or Excel; reuse saved templates

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

open_pdf

Open a PDF (or a scanned image: jpg/png/tiff) and detect its fillable fields. Images are converted to a single-page PDF automatically (deterministically, so a template saved for a photo matches the same photo next time). Resolution order (best source wins): 1. Saved template matching this exact file (deterministic, confidence 1.0) 2. Embedded AcroForm fields (deterministic, confidence 1.0) 3. ML detection (each field carries a confidence score) force_detect=True skips steps 1-2 and re-runs ML detection from scratch — use it to rebuild a layout when th…

ParameterTypeDescription
path *string
force_detectboolean
max_pagesinteger
min_confidencenumber

list_fields

List the current working fields (optionally one page only).

ParameterTypeDescription
page_index

close_workspace

Release the current PDF and field data when work is finished. Saved templates and output PDFs are not deleted. This operation is idempotent, which makes it safe to call from automation cleanup blocks.

render_preview

Render a page with the working field boxes drawn on it. Look at this image to VERIFY placement: blue boxes are deterministic (template/AcroForm/agent-placed); green/orange/red are ML detections by confidence (>=0.7 / >=0.4 / <0.4). Each box is labeled with its field id.

ParameterTypeDescription
page_indexinteger

render_filled_preview

Preview how the filled page will look BEFORE generating the PDF. Draws `values` (field id -> text; checkboxes get an X) into their boxes on the rendered page. Costs nothing — no fill is consumed. Typography is an approximation of the final output (the server typesets the real PDF), so use it to verify placement, alignment and obvious overflow, then fill_pdf.

ParameterTypeDescription
values *object
page_indexinteger

add_field

Add a field the detector missed (a false negative). Coordinates are percentages of the page (0-100), top-left origin — read them off the render_preview image proportionally. align ('left'|'center'|'right') and vertical_align ('top'|'middle'|'bottom') control where the value sits inside the box when the PDF is filled.

ParameterTypeDescription
h *number
w *number
x *number
y *number
align
field_typestring
namestring
page_indexinteger
vertical_align

update_field

Move/resize/rename a field, or set its text alignment. align: 'left'|'center'|'right'; vertical_align: 'top'|'middle'|'bottom' — where the value sits inside the box in the filled PDF.

ParameterTypeDescription
field_id *string
align
field_type
h
name
vertical_align
w
x
y

update_fields

Update many fields in one call (batch version of update_field). Each item: {"field_id": "...", and any of x, y, w, h, name, field_type, align, vertical_align}. Items with an unknown field_id are reported back, the rest are still applied.

ParameterTypeDescription
updates *array

remove_field

Delete a field that isn't a real input (a false positive).

ParameterTypeDescription
field_id *string

remove_fields

Delete many fields in one call (batch version of remove_field).

ParameterTypeDescription
field_ids *array

prune_fields

Bulk-delete fields matching ALL given criteria (e.g. detection noise). field_type: exact type match (e.g. 'cell'); confidence_below / width_below / height_below: strictly-less-than thresholds (w/h in % of page); page_index: limit to one page; exclude_ids: always keep these. Returns the removed ids so the operation is auditable (and reversible via add_field if it cut too much).

ParameterTypeDescription
confidence_below
exclude_ids
field_type
height_below
page_index
width_below

fill_pdf

Fill the PDF and save it. `values` maps field id -> text value (checkboxes: "true"/"yes"/"x" to tick). Fields not present in `values` stay empty. AcroForm fields are filled natively inside the PDF; everything else is drawn at its exact box. The response's `warnings` list flags values that will be shrunk or truncated to fit their box — fix those before delivering the document.

ParameterTypeDescription
output_path *string
values *object
flattenboolean

save_template

Save the current (reviewed) field layout as a reusable template. Next time this exact PDF is opened — by you or another agent session on this account — open_pdf returns these fields with confidence 1.0 and no ML pass at all. This is what makes repeat filling deterministic. Before saving, give every field a short semantic name (update_fields with name=..., e.g. 'age_score', 'total_abcd2') — names are stored in the template, so the next session maps values by meaning instead of guessing from coordinates. Also remove false positives first (remove_fields).

ParameterTypeDescription
name *string

list_templates

List saved templates on this account (name + field count + hash).

ParameterTypeDescription
limitinteger