pdf-form-filler

Fill flattened image-based PDF forms using OCR anchors and PIL image compositing.

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/SillyHippy/zo-skills --skill pdf-form-filler-sillyhippy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pdf-form-filler
Source: https://github.com/SillyHippy/zo-skills/tree/main/skills/pdf-form-filler
Command: npx skills add https://github.com/SillyHippy/zo-skills --skill pdf-form-filler-sillyhippy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytesseract, pymupdf, Pillow, and includes scripts (resource) components.

What problem does it solve? Flattened or scanned PDF forms have no interactive fields, so standard PDF text insertion tools miss field positions and produce misaligned output. This Skill renders pages at high resolution, locates blanks via OCR, and composites text at exact pixel positions. ## Core Features & Use Cases - OCR-Anchored Positioning: Uses pytesseract bounding boxes to find anchor labels and detect blank spaces on the same line for precise placement. - Pixel-Space Compositing: Renders pages at 4x resolution and draws text or checkbox marks with PIL, avoiding PDF coordinate system errors. - Auto Font Sizing: Automatically scales text to fit the detected blank width, with manual coordinate overrides for small or noisy fields. - Use Case: Fill a scanned government or legal form by supplying a JSON list of fields with anchor labels and values, producing a completed PDF ready for submission. ## Quick Start Fill the attached scanned form 'application.pdf' by running the pdf_form_filler.py script with a JSON file defining each field's anchor text and value.

Frequently Asked Questions about pdf-form-filler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fill a flattened PDF form in Python?▼

Render the PDF pages at high resolution with pymupdf, run pytesseract OCR to locate field anchors and blanks, then composite text with PIL at the detected pixel positions. Save the composited images back as a PDF.

How to fill a scanned PDF that has no form fields?▼

Scanned PDFs lack interactive fields, so use image compositing: OCR the rendered page to find label anchors, detect the blank space after each anchor on the same line, and draw the value text into that blank with PIL.

Why does pymupdf text insertion miss field positions on some PDFs?▼

Flattened or image-based PDFs contain no text layer or field coordinates, so PDF-point-based insertion lands incorrectly. Working in pixel space on a rendered image with OCR anchors gives exact positioning instead.

Does pytesseract OCR positioning work on small form text?▼

OCR bounding boxes carry roughly 2-5 pixels of noise at 4x render resolution, and 6-7pt text may be detected inaccurately. For small fields, supply manual x and y coordinates to override anchor-based placement.

What are the limitations of image compositing for PDF forms?▼

The output is an image-based PDF, so filled text is not selectable or searchable. Accuracy depends on OCR quality, and results should be verified visually after filling, especially for dense or low-resolution scans.