Skip to content

How can I update data obtained with getField? #509

@MrVocabulary

Description

@MrVocabulary

Hi! I am quite new to PyPDF2 and I am mostly using snippets of code I have found on the net. What I do is simply filling PDF forms created with Adobe Acrobat XI Pro. While it works perfectly with text fields, I am having trouble setting values of dropdown lists.

I was able to determine that what PyPDF2 sees is (with getField):

{'/FT': '/Ch', '/T': DocumentType', '/Ff': 4325378, '/V': 'D', '/DV': 'W'}

In case of getTextFields, what it shows is:

{'/FT': '/Tx', '/T': 'SupervisorName', '/Ff': 29360130}

But I haven't found a similar method for updating values of those. How can I directly manipulate/update the value of /V here? Can I just replace this entire element with another one, where /V is i.e. "P" (which is one of the choices in the PDF)?

I seek counsel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    is-questionRather a question than an issue. Should usually be a Discussion instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions