PyPDFForm 1.4.36__tar.gz → 1.4.37__tar.gz
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-1.4.36 → pypdfform-1.4.37}/PKG-INFO +2 -1
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/__init__.py +1 -1
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/base.py +13 -1
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/text.py +17 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm.egg-info/PKG-INFO +2 -1
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm.egg-info/SOURCES.txt +1 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/setup.py +1 -0
- pypdfform-1.4.37/tests/test_fill_method.py +141 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/LICENSE +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/adapter.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/constants.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/coordinate.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/filler.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/font.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/image.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/__init__.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/checkbox.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/dropdown.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/image.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/radio.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/middleware/signature.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/patterns.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/template.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/utils.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/watermark.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/widgets/__init__.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/widgets/base.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/widgets/checkbox.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/widgets/dropdown.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/widgets/text.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm/wrapper.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm.egg-info/dependency_links.txt +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm.egg-info/requires.txt +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/PyPDFForm.egg-info/top_level.txt +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/README.md +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/setup.cfg +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_adobe_mode.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_create_widget.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_dropdown.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_dropdown_simple.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_fill_max_length_text_field.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_fill_max_length_text_field_simple.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_functional.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_functional_simple.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_paragraph.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_paragraph_simple.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_preview.py +0 -0
- {pypdfform-1.4.36 → pypdfform-1.4.37}/tests/test_signature.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPDFForm
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.37
|
|
4
4
|
Summary: The Python library for PDF forms.
|
|
5
5
|
Home-page: https://github.com/chinapandaman/PyPDFForm
|
|
6
6
|
Author: Jinge Li
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
17
|
Classifier: License :: OSI Approved :: MIT License
|
|
17
18
|
Classifier: Operating System :: OS Independent
|
|
18
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
@@ -16,7 +16,7 @@ class Widget:
|
|
|
16
16
|
|
|
17
17
|
super().__init__()
|
|
18
18
|
self._name = name
|
|
19
|
-
self.
|
|
19
|
+
self._value = value
|
|
20
20
|
|
|
21
21
|
@property
|
|
22
22
|
def name(self) -> str:
|
|
@@ -24,6 +24,18 @@ class Widget:
|
|
|
24
24
|
|
|
25
25
|
return self._name
|
|
26
26
|
|
|
27
|
+
@property
|
|
28
|
+
def value(self) -> Any:
|
|
29
|
+
"""Value to fill for the widget."""
|
|
30
|
+
|
|
31
|
+
return self._value
|
|
32
|
+
|
|
33
|
+
@value.setter
|
|
34
|
+
def value(self, value: Any) -> None:
|
|
35
|
+
"""Sets value to fill for the widget."""
|
|
36
|
+
|
|
37
|
+
self._value = value
|
|
38
|
+
|
|
27
39
|
@property
|
|
28
40
|
def schema_definition(self) -> dict:
|
|
29
41
|
"""Json schema definition of the widget."""
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""Contains text middleware."""
|
|
3
3
|
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
4
6
|
from .base import Widget
|
|
5
7
|
|
|
6
8
|
|
|
@@ -27,6 +29,21 @@ class Text(Widget):
|
|
|
27
29
|
self.text_line_x_coordinates = None
|
|
28
30
|
self.preview = False
|
|
29
31
|
|
|
32
|
+
@property
|
|
33
|
+
def value(self) -> Any:
|
|
34
|
+
"""Value to fill for the text field."""
|
|
35
|
+
|
|
36
|
+
if isinstance(self._value, (int, float)):
|
|
37
|
+
return str(self._value)
|
|
38
|
+
|
|
39
|
+
return self._value
|
|
40
|
+
|
|
41
|
+
@value.setter
|
|
42
|
+
def value(self, value: str) -> None:
|
|
43
|
+
"""Sets value to fill for the text field."""
|
|
44
|
+
|
|
45
|
+
self._value = value
|
|
46
|
+
|
|
30
47
|
@property
|
|
31
48
|
def schema_definition(self) -> dict:
|
|
32
49
|
"""Json schema definition of the text field."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPDFForm
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.37
|
|
4
4
|
Summary: The Python library for PDF forms.
|
|
5
5
|
Home-page: https://github.com/chinapandaman/PyPDFForm
|
|
6
6
|
Author: Jinge Li
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
17
|
Classifier: License :: OSI Approved :: MIT License
|
|
17
18
|
Classifier: Operating System :: OS Independent
|
|
18
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
@@ -37,6 +37,7 @@ tests/test_dropdown.py
|
|
|
37
37
|
tests/test_dropdown_simple.py
|
|
38
38
|
tests/test_fill_max_length_text_field.py
|
|
39
39
|
tests/test_fill_max_length_text_field_simple.py
|
|
40
|
+
tests/test_fill_method.py
|
|
40
41
|
tests/test_functional.py
|
|
41
42
|
tests/test_functional_simple.py
|
|
42
43
|
tests/test_paragraph.py
|
|
@@ -35,6 +35,7 @@ setuptools.setup(
|
|
|
35
35
|
"Programming Language :: Python :: 3.10",
|
|
36
36
|
"Programming Language :: Python :: 3.11",
|
|
37
37
|
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"Programming Language :: Python :: 3.13",
|
|
38
39
|
"License :: OSI Approved :: MIT License",
|
|
39
40
|
"Operating System :: OS Independent",
|
|
40
41
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
from PyPDFForm import PdfWrapper
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_fill_with_varied_int_values(template_stream, pdf_samples, request):
|
|
9
|
+
expected_path = os.path.join(
|
|
10
|
+
pdf_samples, "fill_method", "sample_filled_varied_ints.pdf"
|
|
11
|
+
)
|
|
12
|
+
with open(expected_path, "rb+") as f:
|
|
13
|
+
obj = PdfWrapper(template_stream).fill(
|
|
14
|
+
{
|
|
15
|
+
"test": 100,
|
|
16
|
+
"test_2": -250,
|
|
17
|
+
"test_3": 0,
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
request.config.results["expected_path"] = expected_path
|
|
22
|
+
request.config.results["stream"] = obj.read()
|
|
23
|
+
|
|
24
|
+
expected = f.read()
|
|
25
|
+
|
|
26
|
+
assert len(obj.read()) == len(expected)
|
|
27
|
+
assert obj.read() == expected
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_fill_with_boolean_and_int_values(template_stream, pdf_samples, request):
|
|
31
|
+
expected_path = os.path.join(
|
|
32
|
+
pdf_samples, "fill_method", "sample_filled_boolean_and_ints.pdf"
|
|
33
|
+
)
|
|
34
|
+
with open(expected_path, "rb+") as f:
|
|
35
|
+
obj = PdfWrapper(template_stream).fill(
|
|
36
|
+
{
|
|
37
|
+
"test": 42,
|
|
38
|
+
"test_2": True,
|
|
39
|
+
"test_3": False,
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
request.config.results["expected_path"] = expected_path
|
|
44
|
+
request.config.results["stream"] = obj.read()
|
|
45
|
+
|
|
46
|
+
expected = f.read()
|
|
47
|
+
|
|
48
|
+
assert len(obj.read()) == len(expected)
|
|
49
|
+
assert obj.read() == expected
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_fill_with_empty_string_and_int(template_stream, pdf_samples, request):
|
|
53
|
+
expected_path = os.path.join(
|
|
54
|
+
pdf_samples, "fill_method", "sample_filled_with_empty_string_and_int.pdf"
|
|
55
|
+
)
|
|
56
|
+
with open(expected_path, "rb+") as f:
|
|
57
|
+
obj = PdfWrapper(template_stream).fill(
|
|
58
|
+
{
|
|
59
|
+
"test": 42,
|
|
60
|
+
"test_2": "",
|
|
61
|
+
"test_3": 33,
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
request.config.results["expected_path"] = expected_path
|
|
66
|
+
request.config.results["stream"] = obj.read()
|
|
67
|
+
|
|
68
|
+
expected = f.read()
|
|
69
|
+
|
|
70
|
+
assert len(obj.read()) == len(expected)
|
|
71
|
+
assert obj.read() == expected
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_fill_with_large_and_small_ints(template_stream, pdf_samples, request):
|
|
75
|
+
expected_path = os.path.join(
|
|
76
|
+
pdf_samples, "fill_method", "sample_filled_large_and_small_ints.pdf"
|
|
77
|
+
)
|
|
78
|
+
with open(expected_path, "rb+") as f:
|
|
79
|
+
obj = PdfWrapper(template_stream).fill(
|
|
80
|
+
{
|
|
81
|
+
"test": 999999999999,
|
|
82
|
+
"test_2": -999999999999,
|
|
83
|
+
"test_3": 1,
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
request.config.results["expected_path"] = expected_path
|
|
88
|
+
request.config.results["stream"] = obj.read()
|
|
89
|
+
|
|
90
|
+
expected = f.read()
|
|
91
|
+
|
|
92
|
+
assert len(obj.read()) == len(expected)
|
|
93
|
+
assert obj.read() == expected
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_fill_with_varied_float_values(template_stream, pdf_samples, request):
|
|
97
|
+
expected_path = os.path.join(
|
|
98
|
+
pdf_samples, "fill_method", "sample_filled_varied_float_values.pdf"
|
|
99
|
+
)
|
|
100
|
+
with open(expected_path, "rb+") as f:
|
|
101
|
+
obj = PdfWrapper(template_stream).fill(
|
|
102
|
+
{
|
|
103
|
+
"test": 1.5,
|
|
104
|
+
"test_2": 13.8,
|
|
105
|
+
"test_3": 543,
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
request.config.results["expected_path"] = expected_path
|
|
110
|
+
request.config.results["stream"] = obj.read()
|
|
111
|
+
|
|
112
|
+
expected = f.read()
|
|
113
|
+
|
|
114
|
+
assert len(obj.read()) == len(expected)
|
|
115
|
+
assert obj.read() == expected
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def test_fill_with_negative_and_positive_floats_and_int(
|
|
119
|
+
template_stream, pdf_samples, request
|
|
120
|
+
):
|
|
121
|
+
expected_path = os.path.join(
|
|
122
|
+
pdf_samples,
|
|
123
|
+
"fill_method",
|
|
124
|
+
"sample_filled_negative_and_positive_floats_and_int.pdf",
|
|
125
|
+
)
|
|
126
|
+
with open(expected_path, "rb+") as f:
|
|
127
|
+
obj = PdfWrapper(template_stream).fill(
|
|
128
|
+
{
|
|
129
|
+
"test": -1.5,
|
|
130
|
+
"test_2": -6.9,
|
|
131
|
+
"test_3": 22,
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
request.config.results["expected_path"] = expected_path
|
|
136
|
+
request.config.results["stream"] = obj.read()
|
|
137
|
+
|
|
138
|
+
expected = f.read()
|
|
139
|
+
|
|
140
|
+
assert len(obj.read()) == len(expected)
|
|
141
|
+
assert obj.read() == expected
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|