PyPDFForm 1.4.25__py3-none-any.whl → 1.4.26__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/template.py +22 -2
- {PyPDFForm-1.4.25.dist-info → PyPDFForm-1.4.26.dist-info}/METADATA +1 -1
- {PyPDFForm-1.4.25.dist-info → PyPDFForm-1.4.26.dist-info}/RECORD +7 -7
- {PyPDFForm-1.4.25.dist-info → PyPDFForm-1.4.26.dist-info}/LICENSE +0 -0
- {PyPDFForm-1.4.25.dist-info → PyPDFForm-1.4.26.dist-info}/WHEEL +0 -0
- {PyPDFForm-1.4.25.dist-info → PyPDFForm-1.4.26.dist-info}/top_level.txt +0 -0
PyPDFForm/__init__.py
CHANGED
PyPDFForm/template.py
CHANGED
|
@@ -134,7 +134,9 @@ def update_text_field_attributes(
|
|
|
134
134
|
if not is_paragraph
|
|
135
135
|
else DEFAULT_FONT_SIZE
|
|
136
136
|
)
|
|
137
|
-
should_adjust_font_size =
|
|
137
|
+
should_adjust_font_size = (
|
|
138
|
+
not template_font_size and widgets[key].max_length is None
|
|
139
|
+
)
|
|
138
140
|
if widgets[key].font_color is None:
|
|
139
141
|
widgets[key].font_color = get_text_field_font_color(_widget)
|
|
140
142
|
if is_paragraph and widgets[key].text_wrap_length is None:
|
|
@@ -142,8 +144,11 @@ def update_text_field_attributes(
|
|
|
142
144
|
widgets[key].text_wrap_length = get_paragraph_auto_wrap_length(
|
|
143
145
|
widgets[key]
|
|
144
146
|
)
|
|
145
|
-
|
|
147
|
+
if widgets[key].value and should_adjust_font_size:
|
|
148
|
+
if is_paragraph:
|
|
146
149
|
adjust_paragraph_font_size(_widget, widgets[key])
|
|
150
|
+
else:
|
|
151
|
+
adjust_text_field_font_size(_widget, widgets[key])
|
|
147
152
|
|
|
148
153
|
|
|
149
154
|
@lru_cache()
|
|
@@ -413,3 +418,18 @@ def adjust_paragraph_font_size(widget: dict, widget_middleware: Text) -> None:
|
|
|
413
418
|
):
|
|
414
419
|
widget_middleware.font_size -= FONT_SIZE_REDUCE_STEP
|
|
415
420
|
widget_middleware.text_lines = get_paragraph_lines(widget, widget_middleware)
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def adjust_text_field_font_size(widget: dict, widget_middleware: Text) -> None:
|
|
424
|
+
"""Reduces the font size of a text field until texts fits."""
|
|
425
|
+
|
|
426
|
+
width = abs(float(widget[Rect][0]) - float(widget[Rect][2]))
|
|
427
|
+
|
|
428
|
+
while (
|
|
429
|
+
widget_middleware.font_size > FONT_SIZE_REDUCE_STEP
|
|
430
|
+
and stringWidth(
|
|
431
|
+
widget_middleware.value, widget_middleware.font, widget_middleware.font_size
|
|
432
|
+
)
|
|
433
|
+
> width
|
|
434
|
+
):
|
|
435
|
+
widget_middleware.font_size -= FONT_SIZE_REDUCE_STEP
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
PyPDFForm/__init__.py,sha256=
|
|
1
|
+
PyPDFForm/__init__.py,sha256=GIJXrHLHY8Ne3c_ffgQ23s5YA4rAD95LogT8kXywkh4,149
|
|
2
2
|
PyPDFForm/adapter.py,sha256=OgAIwcmukpBqHFBLymd3I7wA7wIdipRqgURZA2Y0Hgo,885
|
|
3
3
|
PyPDFForm/constants.py,sha256=bGE1n-vRbyISZ34WVZSJYEKZ6mLa5m7ic9nuo_sO37w,1671
|
|
4
4
|
PyPDFForm/coordinate.py,sha256=V_ZZQ1pXtVPAyfMJCX7fKoEimK7XwX6bU3VQ0nKOhQA,7314
|
|
@@ -6,7 +6,7 @@ PyPDFForm/filler.py,sha256=oj4YkYDZu6kFee9oH8Znw2RyutyFfOJ-oQ-X1WRCKqY,7045
|
|
|
6
6
|
PyPDFForm/font.py,sha256=she3ZZXPblr38XPeaeXA30RY1WdKC3l-RZBi9ZltCRQ,4402
|
|
7
7
|
PyPDFForm/image.py,sha256=0GV8PFgY5oLJFHmhPD1fG-_5SBEO7jVLLtxCc_Uodfo,1143
|
|
8
8
|
PyPDFForm/patterns.py,sha256=Ylfe6s9UV2X7cRAFQjaGoEa4nVSpEn-MLrH7IROp_aY,4332
|
|
9
|
-
PyPDFForm/template.py,sha256=
|
|
9
|
+
PyPDFForm/template.py,sha256=LHRHL5KjFTL-_x_CAbXSG6jzkdXul0rCWne3i1n3rZ0,14201
|
|
10
10
|
PyPDFForm/utils.py,sha256=gDeRDszZ5Q59RjZjJYnikS2pQ_hc78osQH2Oy1TuLsY,4269
|
|
11
11
|
PyPDFForm/watermark.py,sha256=clYdRqCuWEE25IL-BUHnSo4HgLkHPSOl7FUJLhbAfGg,4755
|
|
12
12
|
PyPDFForm/wrapper.py,sha256=tJNN4ODQAoZx7niOje4OYkj6j0_NA6jdqM-7LIt89ag,10506
|
|
@@ -23,8 +23,8 @@ PyPDFForm/widgets/base.py,sha256=Stq-oQt-cfwQ6nilQ4NqpO5udFSKDNb1mAwryrWggZA,207
|
|
|
23
23
|
PyPDFForm/widgets/checkbox.py,sha256=MGB6NGI-XMBz4j2erykgYOCd1pswvthuQ6UFowQOd4o,503
|
|
24
24
|
PyPDFForm/widgets/dropdown.py,sha256=2_R5xcLUWAL0G4raVgWWtE7TJdiWJITay-Gtl8YI2QI,705
|
|
25
25
|
PyPDFForm/widgets/text.py,sha256=x8EglZLYoI9osN9wORLRYoR7lebrpj-wx38QiRH7H1A,629
|
|
26
|
-
PyPDFForm-1.4.
|
|
27
|
-
PyPDFForm-1.4.
|
|
28
|
-
PyPDFForm-1.4.
|
|
29
|
-
PyPDFForm-1.4.
|
|
30
|
-
PyPDFForm-1.4.
|
|
26
|
+
PyPDFForm-1.4.26.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
|
|
27
|
+
PyPDFForm-1.4.26.dist-info/METADATA,sha256=6NAhvrJOi8uWN8LMxCKpsngoEBWT4MhHZLM2GwD7I_8,5367
|
|
28
|
+
PyPDFForm-1.4.26.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
PyPDFForm-1.4.26.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
|
|
30
|
+
PyPDFForm-1.4.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|