python-pdffiller 2.0.0__tar.gz → 2.0.1__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.
Files changed (75) hide show
  1. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/PKG-INFO +1 -1
  2. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/_version.py +1 -1
  3. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/pdf.py +17 -5
  4. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pyproject.toml +1 -1
  5. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/python_pdffiller.egg-info/PKG-INFO +1 -1
  6. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/AUTHORS.rst +0 -0
  7. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/CHANGELOG.md +0 -0
  8. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/COPYING +0 -0
  9. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/MANIFEST.in +0 -0
  10. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/README.rst +0 -0
  11. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/Makefile +0 -0
  12. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/make.bat +0 -0
  13. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/__init__.py +0 -0
  14. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/_static/rtd_literal_block.css +0 -0
  15. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/_static/rtd_theme_overrides.css +0 -0
  16. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/_static/terminal_output.css +0 -0
  17. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/changelog.md +0 -0
  18. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/cli-commands.rst +0 -0
  19. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/cli-usage.rst +0 -0
  20. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/commands/dump_data_fields.rst +0 -0
  21. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/commands/fill_form.rst +0 -0
  22. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/conf.py +0 -0
  23. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/contributing.rst +0 -0
  24. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/docs/source/index.rst +0 -0
  25. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/__init__.py +0 -0
  26. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/__main__.py +0 -0
  27. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/__init__.py +0 -0
  28. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/args.py +0 -0
  29. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/boolean_action.py +0 -0
  30. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/cli.py +0 -0
  31. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/command.py +0 -0
  32. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/commands/__init__.py +0 -0
  33. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/commands/dump_data_fields.py +0 -0
  34. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/commands/fill_form.py +0 -0
  35. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/exit_codes.py +0 -0
  36. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/formatters.py +0 -0
  37. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/once_argument.py +0 -0
  38. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/cli/smart_formatter.py +0 -0
  39. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/const.py +0 -0
  40. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/exceptions.py +0 -0
  41. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/io/__init__.py +0 -0
  42. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/io/colors.py +0 -0
  43. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/io/output.py +0 -0
  44. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/py.typed.py +0 -0
  45. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/typing.py +0 -0
  46. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/utils.py +0 -0
  47. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/widgets/__init__.py +0 -0
  48. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/widgets/base.py +0 -0
  49. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/widgets/checkbox.py +0 -0
  50. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/widgets/radio.py +0 -0
  51. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/pdffiller/widgets/text.py +0 -0
  52. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/python_pdffiller.egg-info/SOURCES.txt +0 -0
  53. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/python_pdffiller.egg-info/dependency_links.txt +0 -0
  54. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/python_pdffiller.egg-info/entry_points.txt +0 -0
  55. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/python_pdffiller.egg-info/requires.txt +0 -0
  56. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/python_pdffiller.egg-info/top_level.txt +0 -0
  57. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/requirements-dev.txt +0 -0
  58. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/requirements-doc.txt +0 -0
  59. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/requirements-lint.txt +0 -0
  60. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/requirements-test.txt +0 -0
  61. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/requirements.txt +0 -0
  62. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/setup.cfg +0 -0
  63. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/setup.py +0 -0
  64. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/__init__.py +0 -0
  65. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/cli/__init__.py +0 -0
  66. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/cli/test_dump_data_field.py +0 -0
  67. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/cli/test_fill_form.py +0 -0
  68. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/conftest.py +0 -0
  69. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/data/empty.pdf +0 -0
  70. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/data/input.pdf +0 -0
  71. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/unit/__init__.py +0 -0
  72. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/unit/test_form_field.py +0 -0
  73. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/unit/test_formatters.py +0 -0
  74. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tests/unit/test_setup.py +0 -0
  75. {python_pdffiller-2.0.0 → python_pdffiller-2.0.1}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-pdffiller
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Interact with PDF by inspecting or filling it
5
5
  Author-email: Jacques Raphanel <jraphanel@sismic.fr>
6
6
  License-Expression: MIT
@@ -3,4 +3,4 @@ __copyright__ = "Copyright 2025 SISMIC"
3
3
  __email__ = "jraphanel@sismic.fr"
4
4
  __license__ = "MIT"
5
5
  __title__ = "pdffiller"
6
- __version__ = "2.0.0"
6
+ __version__ = "2.0.1"
@@ -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
- new_widget.choices = choices
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)
@@ -167,6 +170,13 @@ class Pdf:
167
170
  output = PdfFillerOutput()
168
171
 
169
172
  output.info("filling pdf with input values")
173
+ for page in document:
174
+ for field in page.widgets():
175
+ if (
176
+ field.field_type
177
+ == pymupdf.PDF_WIDGET_TYPE_RADIOBUTTON # pylint: disable=no-member
178
+ ):
179
+ field.field_value = None
170
180
  # Iterate over all pages and process fields
171
181
  for page in document:
172
182
  for field in page.widgets():
@@ -178,8 +188,8 @@ class Pdf:
178
188
  field.field_type
179
189
  == pymupdf.PDF_WIDGET_TYPE_CHECKBOX # pylint: disable=no-member
180
190
  ):
181
- print(f"{field.field_name} => {field.on_state()} vs {value}")
182
- if value.strip() and "Off" != value.strip():
191
+ value = value.replace(" ", "#20")
192
+ if value.strip() and "off" != value.strip().lower():
183
193
  output.verbose(
184
194
  f"updating checkbox with {value} from {field.field_value}"
185
195
  )
@@ -192,11 +202,14 @@ class Pdf:
192
202
  field.field_type
193
203
  == pymupdf.PDF_WIDGET_TYPE_RADIOBUTTON # pylint: disable=no-member
194
204
  ):
195
- if value == field.on_state():
205
+ value = value.replace(" ", "#20")
206
+ if value.lower() == field.on_state().lower():
196
207
  output.verbose(
197
208
  f"updating radiobutton with {value} from {field.field_value}"
198
209
  )
199
210
  field.field_value = value
211
+ else:
212
+ continue
200
213
 
201
214
  # Handling other fields types
202
215
  else:
@@ -207,7 +220,6 @@ class Pdf:
207
220
 
208
221
  # Update the widget!
209
222
  field.update()
210
-
211
223
  try:
212
224
  if flatten:
213
225
  output.info("remove all annotations")
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-pdffiller"
7
- version = "2.0.0"
7
+ version = "2.0.1"
8
8
  description="Interact with PDF by inspecting or filling it"
9
9
  requires-python = ">=3.9"
10
10
  license ="MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-pdffiller
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Interact with PDF by inspecting or filling it
5
5
  Author-email: Jacques Raphanel <jraphanel@sismic.fr>
6
6
  License-Expression: MIT