PyPDFForm 1.4.20__py3-none-any.whl → 1.4.21__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/constants.py +4 -0
- PyPDFForm/coordinate.py +2 -2
- PyPDFForm/filler.py +6 -3
- PyPDFForm/middleware/image.py +8 -0
- PyPDFForm/patterns.py +8 -2
- {PyPDFForm-1.4.20.dist-info → PyPDFForm-1.4.21.dist-info}/METADATA +1 -1
- {PyPDFForm-1.4.20.dist-info → PyPDFForm-1.4.21.dist-info}/RECORD +11 -10
- {PyPDFForm-1.4.20.dist-info → PyPDFForm-1.4.21.dist-info}/LICENSE +0 -0
- {PyPDFForm-1.4.20.dist-info → PyPDFForm-1.4.21.dist-info}/WHEEL +0 -0
- {PyPDFForm-1.4.20.dist-info → PyPDFForm-1.4.21.dist-info}/top_level.txt +0 -0
PyPDFForm/__init__.py
CHANGED
PyPDFForm/constants.py
CHANGED
|
@@ -27,6 +27,8 @@ WIDGET_TYPES = Union[Text, Checkbox, Radio, Dropdown, Signature]
|
|
|
27
27
|
DEPRECATION_NOTICE = "{} will be deprecated soon. Use {} instead."
|
|
28
28
|
|
|
29
29
|
Annots = "/Annots"
|
|
30
|
+
A = "/A"
|
|
31
|
+
JS = "/JS"
|
|
30
32
|
T = "/T"
|
|
31
33
|
Rect = "/Rect"
|
|
32
34
|
Subtype = "/Subtype"
|
|
@@ -64,6 +66,8 @@ PREVIEW_FONT_COLOR = (1, 0, 0)
|
|
|
64
66
|
|
|
65
67
|
NEW_LINE_SYMBOL = "\n"
|
|
66
68
|
|
|
69
|
+
IMAGE_FIELD_IDENTIFIER = "event.target.buttonImportIcon();"
|
|
70
|
+
|
|
67
71
|
DEFAULT_CHECKBOX_STYLE = "\u2713"
|
|
68
72
|
DEFAULT_RADIO_STYLE = "\u25CF"
|
|
69
73
|
BUTTON_STYLES = {
|
PyPDFForm/coordinate.py
CHANGED
|
@@ -38,11 +38,11 @@ def get_draw_checkbox_radio_coordinates(
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def
|
|
41
|
+
def get_draw_image_coordinates_resolutions(
|
|
42
42
|
widget: dict,
|
|
43
43
|
) -> Tuple[float, float, float, float]:
|
|
44
44
|
"""
|
|
45
|
-
Returns coordinates and resolutions to draw
|
|
45
|
+
Returns coordinates and resolutions to draw image at given a PDF form signature/image widget.
|
|
46
46
|
"""
|
|
47
47
|
|
|
48
48
|
x = float(widget[Rect][0])
|
PyPDFForm/filler.py
CHANGED
|
@@ -9,13 +9,14 @@ from pypdf.generic import DictionaryObject
|
|
|
9
9
|
|
|
10
10
|
from .constants import WIDGET_TYPES, Annots
|
|
11
11
|
from .coordinate import (get_draw_checkbox_radio_coordinates,
|
|
12
|
-
|
|
12
|
+
get_draw_image_coordinates_resolutions,
|
|
13
13
|
get_draw_text_coordinates,
|
|
14
14
|
get_text_line_x_coordinates)
|
|
15
15
|
from .font import checkbox_radio_font_size
|
|
16
16
|
from .image import any_image_to_jpg
|
|
17
17
|
from .middleware.checkbox import Checkbox
|
|
18
18
|
from .middleware.dropdown import Dropdown
|
|
19
|
+
from .middleware.image import Image
|
|
19
20
|
from .middleware.radio import Radio
|
|
20
21
|
from .middleware.signature import Signature
|
|
21
22
|
from .middleware.text import Text
|
|
@@ -69,12 +70,14 @@ def fill(
|
|
|
69
70
|
radio_button_tracker[key] += 1
|
|
70
71
|
if widgets[key].value == radio_button_tracker[key] - 1:
|
|
71
72
|
text_needs_to_be_drawn = True
|
|
72
|
-
elif isinstance(widgets[key], Signature):
|
|
73
|
+
elif isinstance(widgets[key], (Signature, Image)):
|
|
73
74
|
stream = widgets[key].stream
|
|
74
75
|
if stream is not None:
|
|
75
76
|
any_image_to_draw = True
|
|
76
77
|
stream = any_image_to_jpg(stream)
|
|
77
|
-
x, y, width, height =
|
|
78
|
+
x, y, width, height = get_draw_image_coordinates_resolutions(
|
|
79
|
+
_widget
|
|
80
|
+
)
|
|
78
81
|
images_to_draw[page].append(
|
|
79
82
|
[
|
|
80
83
|
stream,
|
PyPDFForm/patterns.py
CHANGED
|
@@ -4,15 +4,21 @@
|
|
|
4
4
|
from pypdf.generic import (DictionaryObject, NameObject, NumberObject,
|
|
5
5
|
TextStringObject)
|
|
6
6
|
|
|
7
|
-
from .constants import (AP, AS, CA, DA, FT,
|
|
8
|
-
|
|
7
|
+
from .constants import (AP, AS, CA, DA, FT, IMAGE_FIELD_IDENTIFIER, JS, MK,
|
|
8
|
+
READ_ONLY, A, Btn, Ch, D, Ff, Off, Opt, Parent, Q, Sig,
|
|
9
|
+
Subtype, T, Tx, V, Widget)
|
|
9
10
|
from .middleware.checkbox import Checkbox
|
|
10
11
|
from .middleware.dropdown import Dropdown
|
|
12
|
+
from .middleware.image import Image
|
|
11
13
|
from .middleware.radio import Radio
|
|
12
14
|
from .middleware.signature import Signature
|
|
13
15
|
from .middleware.text import Text
|
|
14
16
|
|
|
15
17
|
WIDGET_TYPE_PATTERNS = [
|
|
18
|
+
(
|
|
19
|
+
({A: {JS: IMAGE_FIELD_IDENTIFIER}},),
|
|
20
|
+
Image,
|
|
21
|
+
),
|
|
16
22
|
(
|
|
17
23
|
({FT: Sig},),
|
|
18
24
|
Signature,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
PyPDFForm/__init__.py,sha256=
|
|
1
|
+
PyPDFForm/__init__.py,sha256=PDxhV2sJfwLrt9zzfKuAB28ejQUJrcx1QJJ1wFhQpTE,149
|
|
2
2
|
PyPDFForm/adapter.py,sha256=OgAIwcmukpBqHFBLymd3I7wA7wIdipRqgURZA2Y0Hgo,885
|
|
3
|
-
PyPDFForm/constants.py,sha256=
|
|
4
|
-
PyPDFForm/coordinate.py,sha256=
|
|
5
|
-
PyPDFForm/filler.py,sha256=
|
|
3
|
+
PyPDFForm/constants.py,sha256=h5h6iFK-mrb3vYAJIWKlXrK8gCEwrMTdkssx_ZoapC4,1520
|
|
4
|
+
PyPDFForm/coordinate.py,sha256=V_ZZQ1pXtVPAyfMJCX7fKoEimK7XwX6bU3VQ0nKOhQA,7314
|
|
5
|
+
PyPDFForm/filler.py,sha256=KY7qAKm1JSXCiFInfQBWUw8K8lCK2p7ZQgBb8fP3bdo,6484
|
|
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=fg8jarqa3fMuNwwOAUKxBkTUdBLi1eTrPzRAPuTB2MI,4193
|
|
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
|
|
@@ -14,6 +14,7 @@ PyPDFForm/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
|
14
14
|
PyPDFForm/middleware/base.py,sha256=TmoO8XpjFa5NerAumrAGm_kUt2eFP3DyyF-Vx0uXloM,724
|
|
15
15
|
PyPDFForm/middleware/checkbox.py,sha256=Z92awlKjceMd_ryb9Fhrtyd4fLkU84Ii6fSum60rHcA,1305
|
|
16
16
|
PyPDFForm/middleware/dropdown.py,sha256=BpRh2YPndhhaLY-s-3gqck64d5FoC719-ARgvfV3_N0,674
|
|
17
|
+
PyPDFForm/middleware/image.py,sha256=xjPxRiGBWFEU3EQGGqJXY1iMX1kmr0jO8O9iVUC5rcc,177
|
|
17
18
|
PyPDFForm/middleware/radio.py,sha256=ehaJoehEzZqxDVb5A6fJkYludeBmtV2Z5GZUPPfUWng,700
|
|
18
19
|
PyPDFForm/middleware/signature.py,sha256=m7tNvGZ7fQ0yuVKzSlLbNQ2IILo1GDnjzMDzMnYCKVM,1104
|
|
19
20
|
PyPDFForm/middleware/text.py,sha256=-ETNQoLvgu5cLkpIQtNYHtq75Ou3P7ezYur-E1yb9-k,1057
|
|
@@ -22,8 +23,8 @@ PyPDFForm/widgets/base.py,sha256=Stq-oQt-cfwQ6nilQ4NqpO5udFSKDNb1mAwryrWggZA,207
|
|
|
22
23
|
PyPDFForm/widgets/checkbox.py,sha256=MGB6NGI-XMBz4j2erykgYOCd1pswvthuQ6UFowQOd4o,503
|
|
23
24
|
PyPDFForm/widgets/dropdown.py,sha256=NYVbtBhmaKNyBh3uTWf4lRz8F2vBfvrruFjdoPWGTb8,998
|
|
24
25
|
PyPDFForm/widgets/text.py,sha256=1-Ww1pK7IMdqBTM0AtQzSSXji4hBgj09l0ZMbFEoZAQ,629
|
|
25
|
-
PyPDFForm-1.4.
|
|
26
|
-
PyPDFForm-1.4.
|
|
27
|
-
PyPDFForm-1.4.
|
|
28
|
-
PyPDFForm-1.4.
|
|
29
|
-
PyPDFForm-1.4.
|
|
26
|
+
PyPDFForm-1.4.21.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
|
|
27
|
+
PyPDFForm-1.4.21.dist-info/METADATA,sha256=d6-0uZQ42VtxRGb9KgLiRWK20RtBLdUfSFpwzDD0cuc,5417
|
|
28
|
+
PyPDFForm-1.4.21.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
PyPDFForm-1.4.21.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
|
|
30
|
+
PyPDFForm-1.4.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|