python-pdffiller 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/PKG-INFO +1 -1
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/_version.py +1 -1
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/pdf.py +21 -5
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pyproject.toml +1 -1
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/PKG-INFO +1 -1
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/cli/test_dump_data_field.py +1 -1
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/unit/test_form_field.py +1 -1
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/AUTHORS.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/CHANGELOG.md +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/COPYING +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/MANIFEST.in +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/README.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/Makefile +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/make.bat +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/_static/rtd_literal_block.css +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/_static/rtd_theme_overrides.css +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/_static/terminal_output.css +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/changelog.md +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/cli-commands.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/cli-usage.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/commands/dump_data_fields.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/commands/fill_form.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/conf.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/contributing.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/index.rst +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/__main__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/args.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/boolean_action.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/cli.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/command.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/commands/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/commands/dump_data_fields.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/commands/fill_form.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/exit_codes.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/formatters.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/once_argument.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/smart_formatter.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/const.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/exceptions.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/io/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/io/colors.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/io/output.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/py.typed.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/typing.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/utils.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/widgets/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/widgets/base.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/widgets/checkbox.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/widgets/radio.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/widgets/text.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/SOURCES.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/dependency_links.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/entry_points.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/requires.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/top_level.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/requirements-dev.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/requirements-doc.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/requirements-lint.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/requirements-test.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/requirements.txt +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/setup.cfg +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/setup.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/cli/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/cli/test_fill_form.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/conftest.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/data/empty.pdf +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/data/input.pdf +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/unit/__init__.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/unit/test_formatters.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tests/unit/test_setup.py +0 -0
- {python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/tox.ini +0 -0
|
@@ -101,7 +101,9 @@ class Pdf:
|
|
|
101
101
|
widget.field_name, i, widget.field_value, widget.field_flags & (1 << 0)
|
|
102
102
|
)
|
|
103
103
|
if choices and isinstance(new_widget, CheckBoxWidget):
|
|
104
|
-
|
|
104
|
+
if "Off" not in choices:
|
|
105
|
+
choices.insert(0, "Off")
|
|
106
|
+
new_widget.choices = [choice.replace("#20", " ") for choice in choices]
|
|
105
107
|
elif isinstance(new_widget, TextWidget):
|
|
106
108
|
new_widget.max_length = widget.text_maxlen
|
|
107
109
|
loaded_widgets[widget.field_name] = new_widget
|
|
@@ -109,6 +111,7 @@ class Pdf:
|
|
|
109
111
|
new_widget = loaded_widgets[widget.field_name]
|
|
110
112
|
if choices and isinstance(new_widget, CheckBoxWidget):
|
|
111
113
|
for each in choices:
|
|
114
|
+
each = each.replace("#20", " ")
|
|
112
115
|
if new_widget.choices is not None:
|
|
113
116
|
if each not in new_widget.choices:
|
|
114
117
|
new_widget.choices.append(each)
|
|
@@ -118,6 +121,10 @@ class Pdf:
|
|
|
118
121
|
cast(CheckBoxWidget, loaded_widgets[widget.field_name]).choices = (
|
|
119
122
|
new_widget.choices
|
|
120
123
|
)
|
|
124
|
+
if "Off" != widget.field_value:
|
|
125
|
+
cast(CheckBoxWidget, loaded_widgets[widget.field_name]).value = (
|
|
126
|
+
widget.field_value
|
|
127
|
+
)
|
|
121
128
|
|
|
122
129
|
self.widgets = loaded_widgets
|
|
123
130
|
|
|
@@ -167,6 +174,13 @@ class Pdf:
|
|
|
167
174
|
output = PdfFillerOutput()
|
|
168
175
|
|
|
169
176
|
output.info("filling pdf with input values")
|
|
177
|
+
for page in document:
|
|
178
|
+
for field in page.widgets():
|
|
179
|
+
if (
|
|
180
|
+
field.field_type
|
|
181
|
+
== pymupdf.PDF_WIDGET_TYPE_RADIOBUTTON # pylint: disable=no-member
|
|
182
|
+
):
|
|
183
|
+
field.field_value = None
|
|
170
184
|
# Iterate over all pages and process fields
|
|
171
185
|
for page in document:
|
|
172
186
|
for field in page.widgets():
|
|
@@ -178,8 +192,8 @@ class Pdf:
|
|
|
178
192
|
field.field_type
|
|
179
193
|
== pymupdf.PDF_WIDGET_TYPE_CHECKBOX # pylint: disable=no-member
|
|
180
194
|
):
|
|
181
|
-
|
|
182
|
-
if value.strip() and "
|
|
195
|
+
value = value.replace(" ", "#20")
|
|
196
|
+
if value.strip() and "off" != value.strip().lower():
|
|
183
197
|
output.verbose(
|
|
184
198
|
f"updating checkbox with {value} from {field.field_value}"
|
|
185
199
|
)
|
|
@@ -192,11 +206,14 @@ class Pdf:
|
|
|
192
206
|
field.field_type
|
|
193
207
|
== pymupdf.PDF_WIDGET_TYPE_RADIOBUTTON # pylint: disable=no-member
|
|
194
208
|
):
|
|
195
|
-
|
|
209
|
+
value = value.replace(" ", "#20")
|
|
210
|
+
if value.lower() == field.on_state().lower():
|
|
196
211
|
output.verbose(
|
|
197
212
|
f"updating radiobutton with {value} from {field.field_value}"
|
|
198
213
|
)
|
|
199
214
|
field.field_value = value
|
|
215
|
+
else:
|
|
216
|
+
continue
|
|
200
217
|
|
|
201
218
|
# Handling other fields types
|
|
202
219
|
else:
|
|
@@ -207,7 +224,6 @@ class Pdf:
|
|
|
207
224
|
|
|
208
225
|
# Update the widget!
|
|
209
226
|
field.update()
|
|
210
|
-
|
|
211
227
|
try:
|
|
212
228
|
if flatten:
|
|
213
229
|
output.info("remove all annotations")
|
|
@@ -17,7 +17,7 @@ def test_valid_pdf(test_data_dir):
|
|
|
17
17
|
assert len(schema[4]["FieldOptions"]) == 4
|
|
18
18
|
assert "Divorced" in schema[4]["FieldOptions"]
|
|
19
19
|
assert "Off" in schema[4]["FieldOptions"]
|
|
20
|
-
assert schema[4]["FieldValue"] == "
|
|
20
|
+
assert schema[4]["FieldValue"] == "Married"
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def test_invalid_pdf(test_data_dir):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/docs/source/_static/rtd_theme_overrides.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/pdffiller/cli/commands/dump_data_fields.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python_pdffiller-2.0.0 → python_pdffiller-2.0.2}/python_pdffiller.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|