PyPDFForm 3.1.2__py3-none-any.whl → 3.1.3__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 +3 -0
- PyPDFForm/font.py +8 -4
- PyPDFForm/middleware/base.py +3 -3
- PyPDFForm/middleware/checkbox.py +1 -1
- PyPDFForm/middleware/dropdown.py +4 -2
- PyPDFForm/middleware/image.py +1 -1
- PyPDFForm/middleware/radio.py +1 -1
- PyPDFForm/middleware/signature.py +1 -1
- PyPDFForm/middleware/text.py +8 -8
- {pypdfform-3.1.2.dist-info → pypdfform-3.1.3.dist-info}/METADATA +1 -1
- {pypdfform-3.1.2.dist-info → pypdfform-3.1.3.dist-info}/RECORD +15 -15
- {pypdfform-3.1.2.dist-info → pypdfform-3.1.3.dist-info}/WHEEL +0 -0
- {pypdfform-3.1.2.dist-info → pypdfform-3.1.3.dist-info}/licenses/LICENSE +0 -0
- {pypdfform-3.1.2.dist-info → pypdfform-3.1.3.dist-info}/top_level.txt +0 -0
PyPDFForm/__init__.py
CHANGED
|
@@ -20,7 +20,7 @@ The library supports various PDF form features, including:
|
|
|
20
20
|
PyPDFForm aims to simplify PDF form manipulation, making it accessible to developers of all skill levels.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
-
__version__ = "3.1.
|
|
23
|
+
__version__ = "3.1.3"
|
|
24
24
|
|
|
25
25
|
from .middleware.text import Text # exposing for setting global font attrs
|
|
26
26
|
from .wrapper import PdfWrapper
|
PyPDFForm/constants.py
CHANGED
|
@@ -69,6 +69,7 @@ Yes = "/Yes"
|
|
|
69
69
|
Off = "/Off"
|
|
70
70
|
|
|
71
71
|
# Font dict
|
|
72
|
+
Length = "/Length"
|
|
72
73
|
Length1 = "/Length1"
|
|
73
74
|
Type = "/Type"
|
|
74
75
|
FontDescriptor = "/FontDescriptor"
|
|
@@ -78,6 +79,8 @@ Font = "/Font"
|
|
|
78
79
|
Subtype = "/Subtype"
|
|
79
80
|
TrueType = "/TrueType"
|
|
80
81
|
BaseFont = "/BaseFont"
|
|
82
|
+
Filter = "/Filter"
|
|
83
|
+
FlateDecode = "/FlateDecode"
|
|
81
84
|
Encoding = "/Encoding"
|
|
82
85
|
WinAnsiEncoding = "/WinAnsiEncoding"
|
|
83
86
|
|
PyPDFForm/font.py
CHANGED
|
@@ -9,6 +9,7 @@ for extracting font information from TTF streams and managing font names within
|
|
|
9
9
|
|
|
10
10
|
from functools import lru_cache
|
|
11
11
|
from io import BytesIO
|
|
12
|
+
from zlib import compress
|
|
12
13
|
|
|
13
14
|
from pypdf import PdfReader, PdfWriter
|
|
14
15
|
from pypdf.generic import (ArrayObject, DictionaryObject, NameObject,
|
|
@@ -17,9 +18,9 @@ from reportlab.pdfbase.pdfmetrics import registerFont
|
|
|
17
18
|
from reportlab.pdfbase.ttfonts import TTFError, TTFont
|
|
18
19
|
|
|
19
20
|
from .constants import (DR, FONT_NAME_PREFIX, AcroForm, BaseFont, Encoding,
|
|
20
|
-
Fields,
|
|
21
|
-
|
|
22
|
-
WinAnsiEncoding)
|
|
21
|
+
Fields, Filter, FlateDecode, Font, FontDescriptor,
|
|
22
|
+
FontFile2, FontName, Length, Length1, Resources,
|
|
23
|
+
Subtype, TrueType, Type, WinAnsiEncoding)
|
|
23
24
|
from .utils import stream_to_io
|
|
24
25
|
|
|
25
26
|
|
|
@@ -119,10 +120,13 @@ def register_font_acroform(pdf: bytes, ttf_stream: bytes, adobe_mode: bool) -> t
|
|
|
119
120
|
)
|
|
120
121
|
|
|
121
122
|
font_file_stream = StreamObject()
|
|
122
|
-
|
|
123
|
+
compressed_ttf = compress(ttf_stream)
|
|
124
|
+
font_file_stream.set_data(compressed_ttf)
|
|
123
125
|
font_file_stream.update(
|
|
124
126
|
{
|
|
125
127
|
NameObject(Length1): NumberObject(len(ttf_stream)),
|
|
128
|
+
NameObject(Length): NumberObject(len(compressed_ttf)),
|
|
129
|
+
NameObject(Filter): NameObject(FlateDecode),
|
|
126
130
|
}
|
|
127
131
|
)
|
|
128
132
|
font_file_ref = writer._add_object(font_file_stream) # type: ignore # noqa: SLF001 # # pylint: disable=W0212
|
PyPDFForm/middleware/base.py
CHANGED
|
@@ -40,9 +40,9 @@ class Widget:
|
|
|
40
40
|
super().__init__()
|
|
41
41
|
self._name = name
|
|
42
42
|
self._value = value
|
|
43
|
-
self.desc = None
|
|
44
|
-
self.readonly = None
|
|
45
|
-
self.hooks_to_trigger = []
|
|
43
|
+
self.desc: str = None
|
|
44
|
+
self.readonly: bool = None
|
|
45
|
+
self.hooks_to_trigger: list = []
|
|
46
46
|
|
|
47
47
|
def __setattr__(self, name: str, value: Any) -> None:
|
|
48
48
|
"""
|
PyPDFForm/middleware/checkbox.py
CHANGED
PyPDFForm/middleware/dropdown.py
CHANGED
|
@@ -6,6 +6,8 @@ This module defines the Dropdown class, which is a subclass of the
|
|
|
6
6
|
Widget class. It represents a dropdown form field in a PDF document.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
9
11
|
from .base import Widget
|
|
10
12
|
|
|
11
13
|
|
|
@@ -50,8 +52,8 @@ class Dropdown(Widget):
|
|
|
50
52
|
)
|
|
51
53
|
super().__init__(name, value)
|
|
52
54
|
|
|
53
|
-
self.font = None
|
|
54
|
-
self.choices = None
|
|
55
|
+
self.font: str = None
|
|
56
|
+
self.choices: Union[tuple, list] = None
|
|
55
57
|
|
|
56
58
|
@property
|
|
57
59
|
def schema_definition(self) -> dict:
|
PyPDFForm/middleware/image.py
CHANGED
PyPDFForm/middleware/radio.py
CHANGED
PyPDFForm/middleware/text.py
CHANGED
|
@@ -55,14 +55,14 @@ class Text(Widget):
|
|
|
55
55
|
)
|
|
56
56
|
super().__init__(name, value)
|
|
57
57
|
|
|
58
|
-
self.font = None
|
|
59
|
-
self.font_size = None
|
|
60
|
-
self.font_color = None
|
|
61
|
-
self.comb = None
|
|
62
|
-
self.alignment = None
|
|
63
|
-
self.multiline = None
|
|
64
|
-
|
|
65
|
-
self.max_length = None
|
|
58
|
+
self.font: str = None
|
|
59
|
+
self.font_size: float = None
|
|
60
|
+
self.font_color: tuple = None
|
|
61
|
+
self.comb: bool = None
|
|
62
|
+
self.alignment: int = None
|
|
63
|
+
self.multiline: bool = None
|
|
64
|
+
|
|
65
|
+
self.max_length: int = None
|
|
66
66
|
|
|
67
67
|
@property
|
|
68
68
|
def value(self) -> str:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
PyPDFForm/__init__.py,sha256=
|
|
1
|
+
PyPDFForm/__init__.py,sha256=Si2S1NESLXeTXj-HLtHdFCntkfhCP3WIG8wCgLdWkbk,925
|
|
2
2
|
PyPDFForm/adapter.py,sha256=8E_PZlXU1ALWez_pWF_U52cynzowK_NQFYzMJoH9VUk,2428
|
|
3
|
-
PyPDFForm/constants.py,sha256=
|
|
3
|
+
PyPDFForm/constants.py,sha256=GU0LcNbN-ttYQVVoFGQLysKByJYF4lKoMideU65z_wI,2523
|
|
4
4
|
PyPDFForm/coordinate.py,sha256=VMVkqa-VAGJSGVvetZwOxeMzIgQtQdvtn_DI_qSecCE,3876
|
|
5
5
|
PyPDFForm/filler.py,sha256=KwStL6YzrNBcDd919ig83MnAxopi8Vnz3QNJzN_CjNM,7272
|
|
6
|
-
PyPDFForm/font.py,sha256=
|
|
6
|
+
PyPDFForm/font.py,sha256=Nyk1dHgC9NBkXDTYiGz9eyCwHadpU-JjR-xOM604cpA,9053
|
|
7
7
|
PyPDFForm/hooks.py,sha256=A8p67ubWvCvzRt346Q7BjOvbi4_NXBcynXmq6fJTadY,11679
|
|
8
8
|
PyPDFForm/image.py,sha256=CAC69jEfSbWbyNJcjLhjWVSNJuFh7frMI70eaiFayHw,3823
|
|
9
9
|
PyPDFForm/patterns.py,sha256=RiQKqsOMrB9u4KWj5Kv6GUmcuGI77xMvdOcOcHy_9qE,8717
|
|
@@ -12,13 +12,13 @@ PyPDFForm/utils.py,sha256=hLSVUG6qnE0iTMB-yPNQQIhmm3R69X7fcnbCTDvSUQs,11001
|
|
|
12
12
|
PyPDFForm/watermark.py,sha256=9p1tjaIqicXngTNai_iOEkCoXRYnR66azB4s7wNsZUw,9349
|
|
13
13
|
PyPDFForm/wrapper.py,sha256=Ysd1mkvE5OfDkjUI6mNFIt16-JUKwj2ifbp1MioWPUo,25257
|
|
14
14
|
PyPDFForm/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
PyPDFForm/middleware/base.py,sha256=
|
|
16
|
-
PyPDFForm/middleware/checkbox.py,sha256=
|
|
17
|
-
PyPDFForm/middleware/dropdown.py,sha256=
|
|
18
|
-
PyPDFForm/middleware/image.py,sha256=
|
|
19
|
-
PyPDFForm/middleware/radio.py,sha256=
|
|
20
|
-
PyPDFForm/middleware/signature.py,sha256=
|
|
21
|
-
PyPDFForm/middleware/text.py,sha256=
|
|
15
|
+
PyPDFForm/middleware/base.py,sha256=zBO9YP01dAEfFKoHKDg10XcpXEuYdFd-pb5wSFmJJj0,3091
|
|
16
|
+
PyPDFForm/middleware/checkbox.py,sha256=OCSZEFD8wQG_Y9qO7Os6VXTaxJCpkRYTxI4wDgG0GZc,1870
|
|
17
|
+
PyPDFForm/middleware/dropdown.py,sha256=4HkVNHoYzH0isdBIdjNtViBx263j4KmYtW0SYzER5zQ,2412
|
|
18
|
+
PyPDFForm/middleware/image.py,sha256=eKM7anU56jbaECnK6rq0jGsBRY3HW_fM86fgA3hq7xA,585
|
|
19
|
+
PyPDFForm/middleware/radio.py,sha256=PuGDJ8RN1C-MkL9Jf14ABWYV67cN18R66dI4nR-03DU,2211
|
|
20
|
+
PyPDFForm/middleware/signature.py,sha256=a2IfD36zpEWXWNNWRvtJ6nG6TszkF6Wil82Szsbjfns,2149
|
|
21
|
+
PyPDFForm/middleware/text.py,sha256=GLKuYvG4BUtNvj-3NkDeIlV1jcouhn7gAqfm9TBWduQ,3936
|
|
22
22
|
PyPDFForm/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
PyPDFForm/widgets/base.py,sha256=kOfxV8HSmwXoy0vFYPgJKKDQ7RUNMACWfX6T4HeJeOU,5177
|
|
24
24
|
PyPDFForm/widgets/bedrock.py,sha256=j6beU04kaQzpAIFZHI5VJLaDT5RVAAa6LzkU1luJpN8,137660
|
|
@@ -28,8 +28,8 @@ PyPDFForm/widgets/image.py,sha256=aSD-3MEZFIRL7HYVuO6Os8irfSUOLHA_rHGkqcEIPPA,85
|
|
|
28
28
|
PyPDFForm/widgets/radio.py,sha256=nWSQQp06kRISO7Q7FVFeB3PXYvMOSc0SMhRs1bHTxeQ,2261
|
|
29
29
|
PyPDFForm/widgets/signature.py,sha256=EqIRIuKSQEg8LJZ_Mu859eEvs0dwO-mzkMNuhHG1Vsg,4034
|
|
30
30
|
PyPDFForm/widgets/text.py,sha256=gtheE6_w0vQPRJJ9oj_l9FaMDEGnPtvVR6_axsrmxKI,1540
|
|
31
|
-
pypdfform-3.1.
|
|
32
|
-
pypdfform-3.1.
|
|
33
|
-
pypdfform-3.1.
|
|
34
|
-
pypdfform-3.1.
|
|
35
|
-
pypdfform-3.1.
|
|
31
|
+
pypdfform-3.1.3.dist-info/licenses/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
|
|
32
|
+
pypdfform-3.1.3.dist-info/METADATA,sha256=2CB-pD0wqfNYa7yfdRcwCsxqzv2nfXE7asKLaSkyT20,4587
|
|
33
|
+
pypdfform-3.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
34
|
+
pypdfform-3.1.3.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
|
|
35
|
+
pypdfform-3.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|