Skip to content

Multi-page PDF autofill resets index and misaligns field values" labels: bug #8

@mdfarid01

Description

@mdfarid01

name: 🐛 Bug Report
about: Create a report to help us improve FireForm.
title: "[BUG]: Multi-page PDF autofill resets index and misaligns field values"
labels: bug
assignees: ''

⚡️ Describe the Bug

In src/backend.py inside Fill.fill_form, the answer index i is reset for every PDF page.
For multi-page forms, page 2 starts filling again from the first extracted answer, causing incorrect field-value mapping.

👣 Steps to Reproduce

  1. Use a fillable PDF with text fields on at least 2 pages.
  2. Provide enough extracted values to fill all fields.
  3. Run Fill.fill_form(...).
  4. Open output PDF and compare values on page 2+ with expected order.

📉 Expected Behavior

Field filling should continue sequentially across all pages, not restart from the first value on each page.

🖥️ Environment Information

  • OS: macOS / Linux (reproducible across environments)
  • Docker/Compose Version: Docker Compose v2.x
  • Ollama Model used: Mistral (via Ollama)

📸 Screenshots/Logs

Relevant code path:
src/backend.py in Fill.fill_form (around lines 151–159).
i = 0 is currently inside for page in pdf.pages:, so the index resets on every page.

🕵️ Possible Fix

Move i = 0 before iterating pages so index is global across the whole document.
Add a regression test with a 2-page fillable PDF fixture to verify correct mapping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions