frescobaldi / python-poppler-qt5

Python binding to libpoppler-qt5
Other
42 stars 32 forks source link

map type for FormFieldChoice::choicesWithExportValues() #45

Closed bnavigator closed 3 years ago

bnavigator commented 3 years ago

Fixes #43

formfieldchoice.pdf made with LibreOffice.

from pprint import pprint
from popplerqt5 import Poppler as poppler
P = poppler.Document.load('formfieldchoice.pdf')
fields = P[0].formFields()
for f in fields:
    print(f.name())
    pprint(f.choicesWithExportValues())
Listfield 1
[('l1', 'l1'), ('l2', 'l2'), ('l3', 'l3')]
Combobox 1
[('Combo Item 1', 'Combo Item 1'),
 ('Combo Item 2', 'Combo Item 2'),
 ('Combo Item a third one', 'Combo Item a third one')]
Empty List Field
[]

(I have no easy access to Acrobat Professional or do not know how to create a PDF Form with a different export value than the field text value)

wbsoft commented 3 years ago

Thank you!!