PyPDFForm 1.4.21__py3-none-any.whl → 1.4.23__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 +2 -1
- PyPDFForm/filler.py +0 -1
- PyPDFForm/font.py +0 -1
- PyPDFForm/template.py +2 -1
- PyPDFForm/widgets/dropdown.py +6 -16
- PyPDFForm/widgets/text.py +1 -1
- PyPDFForm/wrapper.py +2 -1
- {PyPDFForm-1.4.21.dist-info → PyPDFForm-1.4.23.dist-info}/METADATA +2 -3
- {PyPDFForm-1.4.21.dist-info → PyPDFForm-1.4.23.dist-info}/RECORD +13 -13
- {PyPDFForm-1.4.21.dist-info → PyPDFForm-1.4.23.dist-info}/LICENSE +0 -0
- {PyPDFForm-1.4.21.dist-info → PyPDFForm-1.4.23.dist-info}/WHEEL +0 -0
- {PyPDFForm-1.4.21.dist-info → PyPDFForm-1.4.23.dist-info}/top_level.txt +0 -0
PyPDFForm/__init__.py
CHANGED
PyPDFForm/constants.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Union
|
|
|
5
5
|
|
|
6
6
|
from .middleware.checkbox import Checkbox
|
|
7
7
|
from .middleware.dropdown import Dropdown
|
|
8
|
+
from .middleware.image import Image
|
|
8
9
|
from .middleware.radio import Radio
|
|
9
10
|
from .middleware.signature import Signature
|
|
10
11
|
from .middleware.text import Text
|
|
@@ -22,7 +23,7 @@ VERSION_IDENTIFIERS = [
|
|
|
22
23
|
]
|
|
23
24
|
VERSION_IDENTIFIER_PREFIX = b"%PDF-"
|
|
24
25
|
|
|
25
|
-
WIDGET_TYPES = Union[Text, Checkbox, Radio, Dropdown, Signature]
|
|
26
|
+
WIDGET_TYPES = Union[Text, Checkbox, Radio, Dropdown, Signature, Image]
|
|
26
27
|
|
|
27
28
|
DEPRECATION_NOTICE = "{} will be deprecated soon. Use {} instead."
|
|
28
29
|
|
PyPDFForm/filler.py
CHANGED
PyPDFForm/font.py
CHANGED
|
@@ -36,7 +36,6 @@ def register_font(font_name: str, ttf_stream: bytes) -> bool:
|
|
|
36
36
|
def auto_detect_font(widget: dict) -> str:
|
|
37
37
|
"""Returns the font of the text field if it is one of the standard fonts."""
|
|
38
38
|
|
|
39
|
-
# pylint: disable=R0912
|
|
40
39
|
result = DEFAULT_FONT
|
|
41
40
|
|
|
42
41
|
text_appearance = None
|
PyPDFForm/template.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""Contains helpers for generic template related processing."""
|
|
3
3
|
|
|
4
|
+
from functools import lru_cache
|
|
4
5
|
from sys import maxsize
|
|
5
6
|
from typing import Dict, List, Tuple, Union
|
|
6
7
|
|
|
@@ -138,6 +139,7 @@ def update_text_field_attributes(
|
|
|
138
139
|
)
|
|
139
140
|
|
|
140
141
|
|
|
142
|
+
@lru_cache()
|
|
141
143
|
def get_widgets_by_page(pdf: bytes) -> Dict[int, List[dict]]:
|
|
142
144
|
"""Iterates through a PDF and returns all widgets found grouped by page."""
|
|
143
145
|
|
|
@@ -291,7 +293,6 @@ def get_character_x_paddings(widget: dict, widget_middleware: Text) -> List[floa
|
|
|
291
293
|
def get_paragraph_lines(widget: dict, widget_middleware: Text) -> List[str]:
|
|
292
294
|
"""Splits the paragraph field's text to a list of lines."""
|
|
293
295
|
|
|
294
|
-
# pylint: disable=R0912
|
|
295
296
|
lines = []
|
|
296
297
|
result = []
|
|
297
298
|
value = widget_middleware.value or ""
|
PyPDFForm/widgets/dropdown.py
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""Contains dropdown widget to create."""
|
|
3
3
|
|
|
4
|
-
from .
|
|
4
|
+
from .text import TextWidget
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class DropdownWidget(
|
|
7
|
+
class DropdownWidget(TextWidget):
|
|
8
8
|
"""Dropdown widget to create."""
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
USER_PARAMS = [
|
|
13
|
-
("width", "width"),
|
|
14
|
-
("height", "height"),
|
|
15
|
-
("options", "options"),
|
|
16
|
-
("font", "fontName"),
|
|
17
|
-
("font_size", "fontSize"),
|
|
18
|
-
("font_color", "textColor"),
|
|
19
|
-
("bg_color", "fillColor"),
|
|
20
|
-
("border_color", "borderColor"),
|
|
21
|
-
("border_width", "borderWidth"),
|
|
22
|
-
]
|
|
23
|
-
COLOR_PARAMS = ["font_color", "bg_color", "border_color"]
|
|
10
|
+
NONE_DEFAULTS = []
|
|
24
11
|
ACRO_FORM_FUNC = "_textfield"
|
|
25
12
|
|
|
26
13
|
def __init__(
|
|
@@ -33,6 +20,9 @@ class DropdownWidget(Widget):
|
|
|
33
20
|
) -> None:
|
|
34
21
|
"""Sets acro form parameters."""
|
|
35
22
|
|
|
23
|
+
self.USER_PARAMS = super().USER_PARAMS[:-1] + [
|
|
24
|
+
("options", "options"),
|
|
25
|
+
]
|
|
36
26
|
super().__init__(name, page_number, x, y, **kwargs)
|
|
37
27
|
self.acro_form_params["wkind"] = "choice"
|
|
38
28
|
self.acro_form_params["value"] = self.acro_form_params["options"][0]
|
PyPDFForm/widgets/text.py
CHANGED
|
@@ -10,13 +10,13 @@ class TextWidget(Widget):
|
|
|
10
10
|
USER_PARAMS = [
|
|
11
11
|
("width", "width"),
|
|
12
12
|
("height", "height"),
|
|
13
|
-
("max_length", "maxlen"),
|
|
14
13
|
("font", "fontName"),
|
|
15
14
|
("font_size", "fontSize"),
|
|
16
15
|
("font_color", "textColor"),
|
|
17
16
|
("bg_color", "fillColor"),
|
|
18
17
|
("border_color", "borderColor"),
|
|
19
18
|
("border_width", "borderWidth"),
|
|
19
|
+
("max_length", "maxlen"),
|
|
20
20
|
]
|
|
21
21
|
COLOR_PARAMS = ["font_color", "bg_color", "border_color"]
|
|
22
22
|
NONE_DEFAULTS = ["max_length"]
|
PyPDFForm/wrapper.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
+
from functools import cached_property
|
|
6
7
|
from typing import BinaryIO, Dict, List, Tuple, Union
|
|
7
8
|
from warnings import warn
|
|
8
9
|
|
|
@@ -117,7 +118,7 @@ class PdfWrapper(FormWrapper):
|
|
|
117
118
|
|
|
118
119
|
return None
|
|
119
120
|
|
|
120
|
-
@
|
|
121
|
+
@cached_property
|
|
121
122
|
def pages(self) -> List[PdfWrapper]:
|
|
122
123
|
"""Returns a list of pdf wrapper objects where each is a page of the PDF form."""
|
|
123
124
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPDFForm
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.23
|
|
4
4
|
Summary: The Python library for PDF forms.
|
|
5
5
|
Home-page: https://github.com/chinapandaman/PyPDFForm
|
|
6
6
|
Author: Jinge Li
|
|
@@ -8,7 +8,6 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
8
8
|
Classifier: Intended Audience :: Developers
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.8
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -17,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
17
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
18
17
|
Classifier: Operating System :: OS Independent
|
|
19
18
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.8
|
|
21
20
|
Description-Content-Type: text/markdown
|
|
22
21
|
License-File: LICENSE
|
|
23
22
|
Requires-Dist: cryptography
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
PyPDFForm/__init__.py,sha256=
|
|
1
|
+
PyPDFForm/__init__.py,sha256=6DUIYhiG4pJXJFGuIJf8ahcGFzuFYdT-Fzjy1Tz_Kmc,149
|
|
2
2
|
PyPDFForm/adapter.py,sha256=OgAIwcmukpBqHFBLymd3I7wA7wIdipRqgURZA2Y0Hgo,885
|
|
3
|
-
PyPDFForm/constants.py,sha256=
|
|
3
|
+
PyPDFForm/constants.py,sha256=EPEU_CN5MwyRZHFn-BIyaFNpd2yiJXS92v7ValxYts8,1563
|
|
4
4
|
PyPDFForm/coordinate.py,sha256=V_ZZQ1pXtVPAyfMJCX7fKoEimK7XwX6bU3VQ0nKOhQA,7314
|
|
5
|
-
PyPDFForm/filler.py,sha256
|
|
6
|
-
PyPDFForm/font.py,sha256=
|
|
5
|
+
PyPDFForm/filler.py,sha256=-_gWF791ewyXe_VuFENOlimBgIqjyL-GVL6OeVo0xs8,6444
|
|
6
|
+
PyPDFForm/font.py,sha256=73gNAnarFf5G4ghqwr5RnB5YZb_da2HS5L7akHXF5_s,4127
|
|
7
7
|
PyPDFForm/image.py,sha256=0GV8PFgY5oLJFHmhPD1fG-_5SBEO7jVLLtxCc_Uodfo,1143
|
|
8
8
|
PyPDFForm/patterns.py,sha256=fg8jarqa3fMuNwwOAUKxBkTUdBLi1eTrPzRAPuTB2MI,4193
|
|
9
|
-
PyPDFForm/template.py,sha256=
|
|
9
|
+
PyPDFForm/template.py,sha256=BAGQmCd78UxIGb5P_Vlu4ABi39lBdAdM6oxsCDylR_Y,11799
|
|
10
10
|
PyPDFForm/utils.py,sha256=_gskLLNmwhfGF16gfMP00twVY6iYADYYAYWHMvKCDrg,4140
|
|
11
11
|
PyPDFForm/watermark.py,sha256=clYdRqCuWEE25IL-BUHnSo4HgLkHPSOl7FUJLhbAfGg,4755
|
|
12
|
-
PyPDFForm/wrapper.py,sha256=
|
|
12
|
+
PyPDFForm/wrapper.py,sha256=tJNN4ODQAoZx7niOje4OYkj6j0_NA6jdqM-7LIt89ag,10506
|
|
13
13
|
PyPDFForm/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
PyPDFForm/middleware/base.py,sha256=TmoO8XpjFa5NerAumrAGm_kUt2eFP3DyyF-Vx0uXloM,724
|
|
15
15
|
PyPDFForm/middleware/checkbox.py,sha256=Z92awlKjceMd_ryb9Fhrtyd4fLkU84Ii6fSum60rHcA,1305
|
|
@@ -21,10 +21,10 @@ PyPDFForm/middleware/text.py,sha256=-ETNQoLvgu5cLkpIQtNYHtq75Ou3P7ezYur-E1yb9-k,
|
|
|
21
21
|
PyPDFForm/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
PyPDFForm/widgets/base.py,sha256=Stq-oQt-cfwQ6nilQ4NqpO5udFSKDNb1mAwryrWggZA,2076
|
|
23
23
|
PyPDFForm/widgets/checkbox.py,sha256=MGB6NGI-XMBz4j2erykgYOCd1pswvthuQ6UFowQOd4o,503
|
|
24
|
-
PyPDFForm/widgets/dropdown.py,sha256=
|
|
25
|
-
PyPDFForm/widgets/text.py,sha256=
|
|
26
|
-
PyPDFForm-1.4.
|
|
27
|
-
PyPDFForm-1.4.
|
|
28
|
-
PyPDFForm-1.4.
|
|
29
|
-
PyPDFForm-1.4.
|
|
30
|
-
PyPDFForm-1.4.
|
|
24
|
+
PyPDFForm/widgets/dropdown.py,sha256=2_R5xcLUWAL0G4raVgWWtE7TJdiWJITay-Gtl8YI2QI,705
|
|
25
|
+
PyPDFForm/widgets/text.py,sha256=x8EglZLYoI9osN9wORLRYoR7lebrpj-wx38QiRH7H1A,629
|
|
26
|
+
PyPDFForm-1.4.23.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
|
|
27
|
+
PyPDFForm-1.4.23.dist-info/METADATA,sha256=57I92JlOBWwwTxe7wz_v0HSHB9TVJfbtsqdszxDL2bw,5367
|
|
28
|
+
PyPDFForm-1.4.23.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
PyPDFForm-1.4.23.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
|
|
30
|
+
PyPDFForm-1.4.23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|