for a project I will need to autofill over 1000 pdf forms and in the form there is radio button: I found a code:
def radio_button(annotation, value):
for each in annotation['/Kids']:
# determine the export value of each kid
keys = each['/AP']['/N'].keys()
keys.remove('/Off')
export = keys[0]
if f'/{value}' == export:
val_str = pdfrw.objects.pdfname.BasePdfName(f'/{value}')
else:
val_str = pdfrw.objects.pdfname.BasePdfName(f'/Off')
each.update(pdfrw.PdfDict(AS=val_str))
annotation.update(pdfrw.PdfDict(V=pdfrw.objects.pdfname.BasePdfName(f'/{value}')))
It did not really worked out, since I was wondering what the value would be as well as the annotion.
here is the website I used.
Does someone has any ideas?