PyPDFForm 1.4.17__py3-none-any.whl → 1.4.18__py3-none-any.whl

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.

Potentially problematic release.


This version of PyPDFForm might be problematic. Click here for more details.

PyPDFForm/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Contains any object users might need."""
3
3
 
4
- __version__ = "1.4.17"
4
+ __version__ = "1.4.18"
5
5
 
6
6
  from .wrapper import FormWrapper, PdfWrapper, PyPDFForm
PyPDFForm/filler.py CHANGED
@@ -148,20 +148,20 @@ def simple_fill(
148
148
  key = get_widget_key(annot.get_object())
149
149
 
150
150
  widget = widgets.get(key)
151
- if widget is None:
151
+ if widget is None or widget.value is None:
152
152
  continue
153
153
 
154
- if type(widget) is Checkbox and widget.value is True:
155
- simple_update_checkbox_value(annot)
154
+ if type(widget) is Checkbox:
155
+ simple_update_checkbox_value(annot, widget.value)
156
156
  elif isinstance(widget, Radio):
157
157
  if key not in radio_button_tracker:
158
158
  radio_button_tracker[key] = 0
159
159
  radio_button_tracker[key] += 1
160
160
  if widget.value == radio_button_tracker[key] - 1:
161
161
  simple_update_radio_value(annot)
162
- elif isinstance(widget, Dropdown) and widget.value is not None:
162
+ elif isinstance(widget, Dropdown):
163
163
  simple_update_dropdown_value(annot, widget)
164
- elif isinstance(widget, Text) and widget.value:
164
+ elif isinstance(widget, Text):
165
165
  simple_update_text_value(annot, widget)
166
166
 
167
167
  if flatten:
PyPDFForm/patterns.py CHANGED
@@ -80,12 +80,13 @@ BUTTON_STYLE_PATTERNS = [
80
80
  ]
81
81
 
82
82
 
83
- def simple_update_checkbox_value(annot: DictionaryObject) -> None:
83
+ def simple_update_checkbox_value(annot: DictionaryObject, check: bool = False) -> None:
84
84
  """Patterns to update values for checkbox annotations."""
85
85
 
86
86
  for each in annot[AP][D]: # noqa
87
- if str(each) != Off:
87
+ if (check and str(each) != Off) or (not check and str(each) == Off):
88
88
  annot[NameObject(AS)] = NameObject(each)
89
+ annot[NameObject(V)] = NameObject(each)
89
90
  break
90
91
 
91
92
 
@@ -95,6 +96,7 @@ def simple_update_radio_value(annot: DictionaryObject) -> None:
95
96
  for each in annot[AP][D]: # noqa
96
97
  if str(each) != Off:
97
98
  annot[NameObject(AS)] = NameObject(each)
99
+ annot[NameObject(Parent)][NameObject(V)] = NameObject(each) # noqa
98
100
  break
99
101
 
100
102
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPDFForm
3
- Version: 1.4.17
3
+ Version: 1.4.18
4
4
  Summary: The Python library for PDF forms.
5
5
  Home-page: https://github.com/chinapandaman/PyPDFForm
6
6
  Author: Jinge Li
@@ -1,11 +1,11 @@
1
- PyPDFForm/__init__.py,sha256=z2mV0d3DO05R593oviGrHRIjaWnh4pMzMmVJJn_8QIk,149
1
+ PyPDFForm/__init__.py,sha256=cmxVBCR0TESsJY-DpbSLhE0gPyoHMCSlWkHJSCgtIIc,149
2
2
  PyPDFForm/adapter.py,sha256=OgAIwcmukpBqHFBLymd3I7wA7wIdipRqgURZA2Y0Hgo,885
3
3
  PyPDFForm/constants.py,sha256=D2lIBZllCdEcLVsSZ6fRGxEYFaTZj9Ex7ksDxbs7g44,1439
4
4
  PyPDFForm/coordinate.py,sha256=iOy_KEZO3DKsvwdclxZHLOJyrvbCVqJDK2UKmMpEM8E,7310
5
- PyPDFForm/filler.py,sha256=DdPGjVxkFNf1XqLmf-Qjr3xOFL0FX2afTCNC75JwJoc,6422
5
+ PyPDFForm/filler.py,sha256=jwEaxxOqxlzObdqheHGa2mV0REkv-5z4tfhzHwQPe94,6389
6
6
  PyPDFForm/font.py,sha256=y9vNvoaBfgkd5vz9EDp04ul8KDM2jY7J61-VWFng6GY,4155
7
7
  PyPDFForm/image.py,sha256=0GV8PFgY5oLJFHmhPD1fG-_5SBEO7jVLLtxCc_Uodfo,1143
8
- PyPDFForm/patterns.py,sha256=3m_lJ3LmlHY0TxiqrrQzjUCDqrZvhIp9NbMQV1OH28o,3827
8
+ PyPDFForm/patterns.py,sha256=Og2s3KaK2kidgupddj-9DBEFdXl0BPP6lMrV1546RiY,4028
9
9
  PyPDFForm/template.py,sha256=fuoqiYD_4xQXrBgw8XC677EMxJzHaXb9NcVVYbf0r-0,11782
10
10
  PyPDFForm/utils.py,sha256=_gskLLNmwhfGF16gfMP00twVY6iYADYYAYWHMvKCDrg,4140
11
11
  PyPDFForm/watermark.py,sha256=clYdRqCuWEE25IL-BUHnSo4HgLkHPSOl7FUJLhbAfGg,4755
@@ -22,8 +22,8 @@ PyPDFForm/widgets/base.py,sha256=Stq-oQt-cfwQ6nilQ4NqpO5udFSKDNb1mAwryrWggZA,207
22
22
  PyPDFForm/widgets/checkbox.py,sha256=issx3onojq9plTHbNQwEnkbnhTo5vJKA5XSAoxRzQCg,264
23
23
  PyPDFForm/widgets/dropdown.py,sha256=Hzzevm6D0nOFdvZVjXchX4PYcvd_km_zkr8v_UDZKmM,824
24
24
  PyPDFForm/widgets/text.py,sha256=lUVlfQ-ndemSelsKNzY6nS4Kuf_H4mDPxotFMQFV-so,484
25
- PyPDFForm-1.4.17.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
26
- PyPDFForm-1.4.17.dist-info/METADATA,sha256=1MqVBDWRRKZbFjkxhaxv5hviZLVyeG6NM23cx1BLP38,5178
27
- PyPDFForm-1.4.17.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
- PyPDFForm-1.4.17.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
29
- PyPDFForm-1.4.17.dist-info/RECORD,,
25
+ PyPDFForm-1.4.18.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
26
+ PyPDFForm-1.4.18.dist-info/METADATA,sha256=xg9NZgdcXl20ldmHxXPRthVAqTTORXqrQGluJkzWK3U,5178
27
+ PyPDFForm-1.4.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
+ PyPDFForm-1.4.18.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
29
+ PyPDFForm-1.4.18.dist-info/RECORD,,