PyPDFForm 1.5.5__tar.gz → 1.5.6__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.5.5 → pypdfform-1.5.6}/PKG-INFO +1 -1
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/__init__.py +1 -1
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/filler.py +1 -2
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/image.py +0 -25
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/watermark.py +1 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/wrapper.py +1 -2
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm.egg-info/PKG-INFO +1 -1
- {pypdfform-1.5.5 → pypdfform-1.5.6}/LICENSE +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/adapter.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/constants.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/coordinate.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/font.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/__init__.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/base.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/checkbox.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/dropdown.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/image.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/radio.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/signature.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/middleware/text.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/patterns.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/template.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/utils.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/widgets/__init__.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/widgets/base.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/widgets/checkbox.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/widgets/dropdown.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm/widgets/text.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm.egg-info/SOURCES.txt +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm.egg-info/dependency_links.txt +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm.egg-info/requires.txt +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/PyPDFForm.egg-info/top_level.txt +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/README.md +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/setup.cfg +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/setup.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_adobe_mode.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_create_widget.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_dropdown.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_dropdown_simple.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_fill_max_length_text_field.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_fill_max_length_text_field_simple.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_fill_method.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_functional.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_functional_simple.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_paragraph.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_paragraph_simple.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_preview.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_signature.py +0 -0
- {pypdfform-1.5.5 → pypdfform-1.5.6}/tests/test_use_full_widget_name.py +0 -0
|
@@ -13,7 +13,7 @@ from .coordinate import (get_draw_checkbox_radio_coordinates,
|
|
|
13
13
|
get_draw_text_coordinates,
|
|
14
14
|
get_text_line_x_coordinates)
|
|
15
15
|
from .font import checkbox_radio_font_size
|
|
16
|
-
from .image import
|
|
16
|
+
from .image import get_image_dimensions
|
|
17
17
|
from .middleware.checkbox import Checkbox
|
|
18
18
|
from .middleware.dropdown import Dropdown
|
|
19
19
|
from .middleware.image import Image
|
|
@@ -61,7 +61,6 @@ def signature_image_handler(
|
|
|
61
61
|
any_image_to_draw = False
|
|
62
62
|
if stream is not None:
|
|
63
63
|
any_image_to_draw = True
|
|
64
|
-
stream = any_image_to_jpg(stream)
|
|
65
64
|
image_width, image_height = get_image_dimensions(stream)
|
|
66
65
|
x, y, width, height = get_draw_image_coordinates_resolutions(
|
|
67
66
|
widget, middleware.preserve_aspect_ratio, image_width, image_height
|
|
@@ -38,28 +38,3 @@ def get_image_dimensions(image_stream: bytes) -> Tuple[float, float]:
|
|
|
38
38
|
image = Image.open(buff)
|
|
39
39
|
|
|
40
40
|
return image.size
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def any_image_to_jpg(image_stream: bytes) -> bytes:
|
|
44
|
-
"""Converts an image of any type to jpg."""
|
|
45
|
-
|
|
46
|
-
buff = BytesIO()
|
|
47
|
-
buff.write(image_stream)
|
|
48
|
-
buff.seek(0)
|
|
49
|
-
|
|
50
|
-
image = Image.open(buff)
|
|
51
|
-
|
|
52
|
-
if image.format == "JPEG":
|
|
53
|
-
buff.close()
|
|
54
|
-
return image_stream
|
|
55
|
-
|
|
56
|
-
rgb_image = Image.new("RGB", image.size, (255, 255, 255))
|
|
57
|
-
rgb_image.paste(image, mask=image.split()[3] if len(image.split()) == 4 else None)
|
|
58
|
-
|
|
59
|
-
with BytesIO() as _file:
|
|
60
|
-
rgb_image.save(_file, format="JPEG")
|
|
61
|
-
_file.seek(0)
|
|
62
|
-
result = _file.read()
|
|
63
|
-
|
|
64
|
-
buff.close()
|
|
65
|
-
return result
|
|
@@ -13,7 +13,7 @@ from .constants import (DEFAULT_FONT, DEFAULT_FONT_COLOR, DEFAULT_FONT_SIZE,
|
|
|
13
13
|
from .coordinate import generate_coordinate_grid
|
|
14
14
|
from .filler import fill, simple_fill
|
|
15
15
|
from .font import register_font
|
|
16
|
-
from .image import
|
|
16
|
+
from .image import rotate_image
|
|
17
17
|
from .middleware.dropdown import Dropdown
|
|
18
18
|
from .middleware.text import Text
|
|
19
19
|
from .template import (build_widgets, dropdown_to_text,
|
|
@@ -354,7 +354,6 @@ class PdfWrapper(FormWrapper):
|
|
|
354
354
|
"""Draws an image on a PDF form."""
|
|
355
355
|
|
|
356
356
|
image = fp_or_f_obj_or_stream_to_stream(image)
|
|
357
|
-
image = any_image_to_jpg(image)
|
|
358
357
|
image = rotate_image(image, rotation)
|
|
359
358
|
watermarks = create_watermarks_and_draw(
|
|
360
359
|
self.stream, page_number, "image", [[image, x, y, width, height]]
|
|
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
|
|
File without changes
|
|
File without changes
|