PyPDFForm 1.4.17__py3-none-any.whl → 1.4.19__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 +1 -1
- PyPDFForm/filler.py +5 -5
- PyPDFForm/patterns.py +4 -2
- PyPDFForm/widgets/checkbox.py +9 -1
- PyPDFForm/widgets/dropdown.py +6 -1
- PyPDFForm/widgets/text.py +4 -1
- {PyPDFForm-1.4.17.dist-info → PyPDFForm-1.4.19.dist-info}/METADATA +1 -2
- {PyPDFForm-1.4.17.dist-info → PyPDFForm-1.4.19.dist-info}/RECORD +11 -11
- {PyPDFForm-1.4.17.dist-info → PyPDFForm-1.4.19.dist-info}/LICENSE +0 -0
- {PyPDFForm-1.4.17.dist-info → PyPDFForm-1.4.19.dist-info}/WHEEL +0 -0
- {PyPDFForm-1.4.17.dist-info → PyPDFForm-1.4.19.dist-info}/top_level.txt +0 -0
PyPDFForm/__init__.py
CHANGED
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
|
|
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)
|
|
162
|
+
elif isinstance(widget, Dropdown):
|
|
163
163
|
simple_update_dropdown_value(annot, widget)
|
|
164
|
-
elif isinstance(widget, Text)
|
|
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
|
|
PyPDFForm/widgets/checkbox.py
CHANGED
|
@@ -7,5 +7,13 @@ from .base import Widget
|
|
|
7
7
|
class CheckBoxWidget(Widget):
|
|
8
8
|
"""Checkbox widget to create."""
|
|
9
9
|
|
|
10
|
-
USER_PARAMS = [
|
|
10
|
+
USER_PARAMS = [
|
|
11
|
+
("size", "size"),
|
|
12
|
+
("button_style", "buttonStyle"),
|
|
13
|
+
("tick_color", "textColor"),
|
|
14
|
+
("bg_color", "fillColor"),
|
|
15
|
+
("border_color", "borderColor"),
|
|
16
|
+
("border_width", "borderWidth"),
|
|
17
|
+
]
|
|
18
|
+
COLOR_PARAMS = ["tick_color", "bg_color", "border_color"]
|
|
11
19
|
ACRO_FORM_FUNC = "checkbox"
|
PyPDFForm/widgets/dropdown.py
CHANGED
|
@@ -7,6 +7,8 @@ from .base import Widget
|
|
|
7
7
|
class DropdownWidget(Widget):
|
|
8
8
|
"""Dropdown widget to create."""
|
|
9
9
|
|
|
10
|
+
# pylint: disable=R0801
|
|
11
|
+
|
|
10
12
|
USER_PARAMS = [
|
|
11
13
|
("width", "width"),
|
|
12
14
|
("height", "height"),
|
|
@@ -14,8 +16,11 @@ class DropdownWidget(Widget):
|
|
|
14
16
|
("font", "fontName"),
|
|
15
17
|
("font_size", "fontSize"),
|
|
16
18
|
("font_color", "textColor"),
|
|
19
|
+
("bg_color", "fillColor"),
|
|
20
|
+
("border_color", "borderColor"),
|
|
21
|
+
("border_width", "borderWidth"),
|
|
17
22
|
]
|
|
18
|
-
COLOR_PARAMS = ["font_color"]
|
|
23
|
+
COLOR_PARAMS = ["font_color", "bg_color", "border_color"]
|
|
19
24
|
ACRO_FORM_FUNC = "_textfield"
|
|
20
25
|
|
|
21
26
|
def __init__(
|
PyPDFForm/widgets/text.py
CHANGED
|
@@ -14,7 +14,10 @@ class TextWidget(Widget):
|
|
|
14
14
|
("font", "fontName"),
|
|
15
15
|
("font_size", "fontSize"),
|
|
16
16
|
("font_color", "textColor"),
|
|
17
|
+
("bg_color", "fillColor"),
|
|
18
|
+
("border_color", "borderColor"),
|
|
19
|
+
("border_width", "borderWidth"),
|
|
17
20
|
]
|
|
18
|
-
COLOR_PARAMS = ["font_color"]
|
|
21
|
+
COLOR_PARAMS = ["font_color", "bg_color", "border_color"]
|
|
19
22
|
NONE_DEFAULTS = ["max_length"]
|
|
20
23
|
ACRO_FORM_FUNC = "textfield"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPDFForm
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.19
|
|
4
4
|
Summary: The Python library for PDF forms.
|
|
5
5
|
Home-page: https://github.com/chinapandaman/PyPDFForm
|
|
6
6
|
Author: Jinge Li
|
|
@@ -29,7 +29,6 @@ Requires-Dist: reportlab
|
|
|
29
29
|
<p align="center">
|
|
30
30
|
<a href="https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-black-isort.yml/badge.svg"><img src="https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-black-isort.yml/badge.svg"></a>
|
|
31
31
|
<a href="https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-package.yml/badge.svg"><img src="https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-package.yml/badge.svg"></a>
|
|
32
|
-
<a href="https://codecov.io/gh/chinapandaman/PyPDFForm"><img src="https://codecov.io/gh/chinapandaman/PyPDFForm/branch/master/graph/badge.svg?token=CSRLN14IFE"></a>
|
|
33
32
|
<a href="https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-publish.yml/badge.svg"><img src="https://github.com/chinapandaman/PyPDFForm/actions/workflows/python-publish.yml/badge.svg"></a>
|
|
34
33
|
<a href="https://pepy.tech/project/pypdfform"><img src="https://static.pepy.tech/personalized-badge/pypdfform?period=total&units=international_system&left_color=black&right_color=blue&left_text=Downloads"></a>
|
|
35
34
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-orange.svg"></a>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
PyPDFForm/__init__.py,sha256=
|
|
1
|
+
PyPDFForm/__init__.py,sha256=sL7C8EdPJNMPqdEm3MZs-mtP8MiY1Fu5lxF_AykPyJo,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=
|
|
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=
|
|
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
|
|
@@ -19,11 +19,11 @@ PyPDFForm/middleware/signature.py,sha256=m7tNvGZ7fQ0yuVKzSlLbNQ2IILo1GDnjzMDzMnY
|
|
|
19
19
|
PyPDFForm/middleware/text.py,sha256=-ETNQoLvgu5cLkpIQtNYHtq75Ou3P7ezYur-E1yb9-k,1057
|
|
20
20
|
PyPDFForm/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
PyPDFForm/widgets/base.py,sha256=Stq-oQt-cfwQ6nilQ4NqpO5udFSKDNb1mAwryrWggZA,2076
|
|
22
|
-
PyPDFForm/widgets/checkbox.py,sha256=
|
|
23
|
-
PyPDFForm/widgets/dropdown.py,sha256=
|
|
24
|
-
PyPDFForm/widgets/text.py,sha256=
|
|
25
|
-
PyPDFForm-1.4.
|
|
26
|
-
PyPDFForm-1.4.
|
|
27
|
-
PyPDFForm-1.4.
|
|
28
|
-
PyPDFForm-1.4.
|
|
29
|
-
PyPDFForm-1.4.
|
|
22
|
+
PyPDFForm/widgets/checkbox.py,sha256=MGB6NGI-XMBz4j2erykgYOCd1pswvthuQ6UFowQOd4o,503
|
|
23
|
+
PyPDFForm/widgets/dropdown.py,sha256=NYVbtBhmaKNyBh3uTWf4lRz8F2vBfvrruFjdoPWGTb8,998
|
|
24
|
+
PyPDFForm/widgets/text.py,sha256=1-Ww1pK7IMdqBTM0AtQzSSXji4hBgj09l0ZMbFEoZAQ,629
|
|
25
|
+
PyPDFForm-1.4.19.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
|
|
26
|
+
PyPDFForm-1.4.19.dist-info/METADATA,sha256=YQ2yoZPWtwaz1_fizRRpC_Ur1PohDTevPi67aJHLW3I,5009
|
|
27
|
+
PyPDFForm-1.4.19.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
28
|
+
PyPDFForm-1.4.19.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
|
|
29
|
+
PyPDFForm-1.4.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|