diff --git a/Resources/form.pdf b/Resources/form.pdf new file mode 100644 index 000000000..45c0604e9 Binary files /dev/null and b/Resources/form.pdf differ diff --git a/Resources/form_acrobatReader.pdf b/Resources/form_acrobatReader.pdf new file mode 100644 index 000000000..6f4d7c6fc Binary files /dev/null and b/Resources/form_acrobatReader.pdf differ diff --git a/Resources/form_evince.pdf b/Resources/form_evince.pdf new file mode 100644 index 000000000..ae315045a Binary files /dev/null and b/Resources/form_evince.pdf differ diff --git a/Tests/test_reader.py b/Tests/test_reader.py index d7d88bb64..841d91ffc 100644 --- a/Tests/test_reader.py +++ b/Tests/test_reader.py @@ -226,3 +226,19 @@ def test_get_page_of_encrypted_file(): reader.decrypt("test") reader.getPage(0) + + +@pytest.mark.parametrize( + "src,expected", + [ + ("form.pdf", {"foo": ""}), + ("form_acrobatReader.pdf", {"foo": "Bar"}), + ("form_evince.pdf", {"foo": "bar"}), + ], +) +def test_form(src, expected): + """Check if we can read out form data.""" + src = os.path.join(RESOURCE_ROOT, src) + pdf = PdfFileReader(src) + fields = pdf.getFormTextFields() + assert fields == expected