Skip to content

[BUG]: Multi-page PDF filling resets answer index and misaligns fieldsΒ #238

@Aryama-srivastav

Description

@Aryama-srivastav

name: πŸ› Bug Report
about: Create a report to help us improve FireForm.
title: "[BUG]: Multi-page PDF filling resets answer index and misaligns fields"
labels: bug
assignees: @Aryama-srivastav

⚑️ Describe the Bug

In PDF filling logic, the answer index is reset for each page (i = 0 inside the page loop), so multi-page forms can re-use early answers on later pages instead of continuing sequentially.

This causes field/value misalignment and incorrect output PDFs when the template has form widgets across multiple pages.

πŸ‘£ Steps to Reproduce

  1. Use a fillable PDF with widget fields on at least 2 pages.
  2. Provide enough extracted values to populate fields across both pages.
  3. Run the fill flow (Controller/FileManipulator/Filler path).
  4. Inspect output PDF values on page 2: early values are repeated or later values are skipped.

πŸ“‰ Expected Behavior

The answer cursor should continue globally across all pages:

  • page 1 fills first N values
  • page 2 continues from value N+1
  • no value repetition caused by per-page index reset

πŸ–₯️ Environment Information

  • OS: (e.g. Ubuntu 22.04, MacOS M2, Windows 11)
  • Docker/Compose Version: (output of docker --version and docker compose version)
  • Ollama Model used: (e.g. Mistral-7b)

πŸ•΅οΈ Possible Fix

Pseudo-fix:

i = 0
for page in pdf.pages:
    ...
    for annot in sorted_annots:
        if is_widget and i < len(answers_list):
            annot.V = f"{answers_list[i]}"
            i += 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions