Skip to content

PPF-1298: Created fields have no entries in the Interactive Form (AcroForm) Dictionary #1298

@MosheLaks

Description

@MosheLaks

Version

PyPDFForm=3.8.2

Issue Description

When I use the create_field or bulk_create_fields methods, the fields are created, but they have no entries in the Interactive Form Dictionary which is supposed to list all the fields in a PDF Form. This causes the PyPDF library to not see the fields (I use PyPDF to get the coordinates of fields on an existing PDF, since this library does not expose that data)

The PDF Spec describes the Interactive Form dictionary in section 12.7.2 (here).
See also section 7.7.2 for a description of the Document Catalog, which is supposed to link the Interactive Form in the AcroForm entry
In the example below, there is no AcroForm entry at all; other times I have seen it with an empty field list. I used this site to inspect my PDF, but maybe you have better tools.

Code Snippet

from PyPDFForm import PdfWrapper, BlankPage, Fields

def demo(output:str):
    wrapper = PdfWrapper(BlankPage())
    fields = [
        Fields.TextField(name="Test1", page_number=1, x=100, y=600),
        Fields.TextField(name="Test2", page_number=1, x=100, y=500),
    ]
    wrapper.bulk_create_fields(fields)
    wrapper.create_field(
        Fields.TextField(
            name="Test3", page_number=1, x=100, y=400
        )
    )
    wrapper.write(output)

PDF Form Template

test.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions