Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get status of radiobuttons and checkboxes? #1334

Closed
Rapid1898-code opened this issue Sep 8, 2022 · 3 comments
Closed

Get status of radiobuttons and checkboxes? #1334

Rapid1898-code opened this issue Sep 8, 2022 · 3 comments
Labels
is-feature A feature request workflow-forms From a users perspective, forms is the affected feature/workflow

Comments

@Rapid1898-code
Copy link

Rapid1898-code commented Sep 8, 2022

Hello - i try to get the status (checked / unchecked) of the radiobuttons and checkboxes in this document.

I tried it with the following code but I always get a None return

Example

from PyPDF2 import PdfReader

reader = PdfReader ("input.pdf")
fields = reader.get_fields()    
print(fields)

Find attached the pdf-file i want to read:
input.pdf

Is it possible to get this information for the radio buttons and check boxes?

@MartinThoma MartinThoma added the workflow-forms From a users perspective, forms is the affected feature/workflow label Sep 9, 2022
@MartinThoma MartinThoma added the is-feature A feature request label Sep 24, 2022
@vphan6896
Copy link

I think your input file displays the radio buttons as graphics. I was able to use get_fields() on https://media.wizards.com/2016/dnd/downloads/5E_CharacterSheet_Fillable.pdf and got several fields back.

@pubpub-zz
Copy link
Collaborator

pubpub-zz commented May 28, 2023

in general:
get_fields report both the check box status in "/V" (/Off or the name of the active state) for the radio buttons the selected active state is reported too (in this case the radio buttons are in the kids field)

for you specific case, @vphan6896 is right

Edit
PR #1864 adds /States in fields to provide the list of possible values for Checkboxes, RadioButtons, and Lists

@pubpub-zz
Copy link
Collaborator

this issue is closed with #1864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-feature A feature request workflow-forms From a users perspective, forms is the affected feature/workflow
Projects
None yet
Development

No branches or pull requests

4 participants