hpe_fill_slots
Inject answers into PDF form slots by ID to populate worksheets, with baseline-snapped text, centered options, multi-line wrapping, and clean output containing only answers.
Instructions
Inject answers into the PDF using Slot IDs (e.g. {"S01": "answer", "S02": "B"}). Guarantees:
100% baseline snap on printed lines (zero floating text).
100% center alignment in boxes (zero off-center boxes).
Automatic multi-line wrapping across consecutive lines for long answers.
Automatic font scaling to avoid text collision or overflow.
100% CLEAN OUTPUT: Final PDF contains ONLY answers (zero grid lines, zero badges). Args: pdf_path: Path to target PDF. page_number: 1-based page number. slot_answers_json: JSON string mapping slot tags to answers: e.g. '{"S01": "went", "S02": ["line 1 text", "line 2 text"], "circle_option": "A"}'
output_path: Optional output path. If omitted, overwrites safely via atomic replace. Returns status JSON with saved path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_path | Yes | ||
| output_path | No | ||
| page_number | Yes | ||
| slot_answers_json | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |