PyPDFForm 1.4.22__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Contains any object users might need."""
3
3
 
4
- __version__ = "1.4.22"
4
+ __version__ = "1.4.23"
5
5
 
6
6
  from .wrapper import FormWrapper, PdfWrapper, PyPDFForm
PyPDFForm/filler.py CHANGED
@@ -35,7 +35,6 @@ def fill(
35
35
  ) -> bytes:
36
36
  """Fills a PDF using watermarks."""
37
37
 
38
- # pylint: disable=too-many-branches
39
38
  texts_to_draw = {}
40
39
  images_to_draw = {}
41
40
  any_image_to_draw = False
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 ""
@@ -1,26 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Contains dropdown widget to create."""
3
3
 
4
- from .base import Widget
4
+ from .text import TextWidget
5
5
 
6
6
 
7
- class DropdownWidget(Widget):
7
+ class DropdownWidget(TextWidget):
8
8
  """Dropdown widget to create."""
9
9
 
10
- # pylint: disable=R0801
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"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPDFForm
3
- Version: 1.4.22
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
@@ -1,12 +1,12 @@
1
- PyPDFForm/__init__.py,sha256=uOJ2Qv-iFKP_cD4QsBVtIo-QweqFJRxBjZleu2TXyY8,149
1
+ PyPDFForm/__init__.py,sha256=6DUIYhiG4pJXJFGuIJf8ahcGFzuFYdT-Fzjy1Tz_Kmc,149
2
2
  PyPDFForm/adapter.py,sha256=OgAIwcmukpBqHFBLymd3I7wA7wIdipRqgURZA2Y0Hgo,885
3
3
  PyPDFForm/constants.py,sha256=EPEU_CN5MwyRZHFn-BIyaFNpd2yiJXS92v7ValxYts8,1563
4
4
  PyPDFForm/coordinate.py,sha256=V_ZZQ1pXtVPAyfMJCX7fKoEimK7XwX6bU3VQ0nKOhQA,7314
5
- PyPDFForm/filler.py,sha256=KY7qAKm1JSXCiFInfQBWUw8K8lCK2p7ZQgBb8fP3bdo,6484
6
- PyPDFForm/font.py,sha256=y9vNvoaBfgkd5vz9EDp04ul8KDM2jY7J61-VWFng6GY,4155
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=fuoqiYD_4xQXrBgw8XC677EMxJzHaXb9NcVVYbf0r-0,11782
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
12
  PyPDFForm/wrapper.py,sha256=tJNN4ODQAoZx7niOje4OYkj6j0_NA6jdqM-7LIt89ag,10506
@@ -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=NYVbtBhmaKNyBh3uTWf4lRz8F2vBfvrruFjdoPWGTb8,998
25
- PyPDFForm/widgets/text.py,sha256=1-Ww1pK7IMdqBTM0AtQzSSXji4hBgj09l0ZMbFEoZAQ,629
26
- PyPDFForm-1.4.22.dist-info/LICENSE,sha256=43awmYkI6opyTpg19me731iO1WfXZwViqb67oWtCsFY,1065
27
- PyPDFForm-1.4.22.dist-info/METADATA,sha256=9b_MNQfYKBxqwuFSaBhmCH0wsIyqJ4WlhCemAPTqQzU,5367
28
- PyPDFForm-1.4.22.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
29
- PyPDFForm-1.4.22.dist-info/top_level.txt,sha256=GQQKuWqPUjT9YZqwK95NlAQzxjwoQrsxQ8ureM8lWOY,10
30
- PyPDFForm-1.4.22.dist-info/RECORD,,
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,,