PyPDFForm 1.4.28__tar.gz → 1.4.30__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.

Files changed (47) hide show
  1. {pypdfform-1.4.28 → pypdfform-1.4.30}/PKG-INFO +2 -8
  2. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/__init__.py +1 -1
  3. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/constants.py +1 -2
  4. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/patterns.py +3 -3
  5. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/wrapper.py +5 -1
  6. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm.egg-info/PKG-INFO +2 -8
  7. {pypdfform-1.4.28 → pypdfform-1.4.30}/README.md +1 -7
  8. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_functional.py +21 -0
  9. {pypdfform-1.4.28 → pypdfform-1.4.30}/LICENSE +0 -0
  10. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/adapter.py +0 -0
  11. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/coordinate.py +0 -0
  12. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/filler.py +0 -0
  13. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/font.py +0 -0
  14. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/image.py +0 -0
  15. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/__init__.py +0 -0
  16. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/base.py +0 -0
  17. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/checkbox.py +0 -0
  18. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/dropdown.py +0 -0
  19. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/image.py +0 -0
  20. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/radio.py +0 -0
  21. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/signature.py +0 -0
  22. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/middleware/text.py +0 -0
  23. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/template.py +0 -0
  24. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/utils.py +0 -0
  25. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/watermark.py +0 -0
  26. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/widgets/__init__.py +0 -0
  27. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/widgets/base.py +0 -0
  28. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/widgets/checkbox.py +0 -0
  29. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/widgets/dropdown.py +0 -0
  30. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm/widgets/text.py +0 -0
  31. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm.egg-info/SOURCES.txt +0 -0
  32. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm.egg-info/dependency_links.txt +0 -0
  33. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm.egg-info/requires.txt +0 -0
  34. {pypdfform-1.4.28 → pypdfform-1.4.30}/PyPDFForm.egg-info/top_level.txt +0 -0
  35. {pypdfform-1.4.28 → pypdfform-1.4.30}/setup.cfg +0 -0
  36. {pypdfform-1.4.28 → pypdfform-1.4.30}/setup.py +0 -0
  37. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_adobe_mode.py +0 -0
  38. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_create_widget.py +0 -0
  39. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_dropdown.py +0 -0
  40. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_dropdown_simple.py +0 -0
  41. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_fill_max_length_text_field.py +0 -0
  42. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_fill_max_length_text_field_simple.py +0 -0
  43. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_functional_simple.py +0 -0
  44. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_paragraph.py +0 -0
  45. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_paragraph_simple.py +0 -0
  46. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_preview.py +0 -0
  47. {pypdfform-1.4.28 → pypdfform-1.4.30}/tests/test_signature.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPDFForm
3
- Version: 1.4.28
3
+ Version: 1.4.30
4
4
  Summary: The Python library for PDF forms.
5
5
  Home-page: https://github.com/chinapandaman/PyPDFForm
6
6
  Author: Jinge Li
@@ -83,12 +83,6 @@ and it should look like [this](https://github.com/chinapandaman/PyPDFForm/raw/ma
83
83
 
84
84
  The official documentation can be found on [the GitHub page](https://chinapandaman.github.io/PyPDFForm/) of this repository.
85
85
 
86
- ## Public Speak
86
+ ## Other Resources
87
87
 
88
88
  [Chicago Python User Group - Dec 14, 2023](https://youtu.be/8t1RdAKwr9w?si=TLgumBNXv9H8szSn)
89
-
90
- ## How to Contribute
91
-
92
- It is difficult to make sure that the library supports all the PDF form creating tools out
93
- there. So if you run into a case where the library does not work for certain PDF forms created by certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
94
- to make the library support the attached PDF form as well as the tool used to create it.
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Contains any object users might need."""
3
3
 
4
- __version__ = "1.4.28"
4
+ __version__ = "1.4.30"
5
5
 
6
6
  from .wrapper import FormWrapper, PdfWrapper
@@ -32,8 +32,6 @@ A = "/A"
32
32
  JS = "/JS"
33
33
  T = "/T"
34
34
  Rect = "/Rect"
35
- Subtype = "/Subtype"
36
- Widget = "/Widget"
37
35
  FT = "/FT"
38
36
  Parent = "/Parent"
39
37
  Ff = "/Ff"
@@ -43,6 +41,7 @@ AP = "/AP"
43
41
  N = "/N"
44
42
  Sig = "/Sig"
45
43
  DA = "/DA"
44
+ DV = "/DV"
46
45
  Btn = "/Btn"
47
46
  MaxLen = "/MaxLen"
48
47
  Q = "/Q"
@@ -4,9 +4,9 @@
4
4
  from pypdf.generic import (DictionaryObject, NameObject, NumberObject,
5
5
  TextStringObject)
6
6
 
7
- from .constants import (AP, AS, CA, DA, FT, IMAGE_FIELD_IDENTIFIER, JS, MK,
7
+ from .constants import (AP, AS, CA, DA, DV, FT, IMAGE_FIELD_IDENTIFIER, JS, MK,
8
8
  READ_ONLY, A, Btn, Ch, Ff, N, Off, Opt, Parent, Q, Sig,
9
- Subtype, T, Tx, V, Widget, Yes)
9
+ T, Tx, V, Yes)
10
10
  from .middleware.checkbox import Checkbox
11
11
  from .middleware.dropdown import Dropdown
12
12
  from .middleware.image import Image
@@ -49,7 +49,7 @@ WIDGET_TYPE_PATTERNS = [
49
49
  (
50
50
  (
51
51
  {Parent: {FT: Btn}},
52
- {Parent: {Subtype: Widget}},
52
+ {Parent: {DV: (Yes, Off)}},
53
53
  {AS: (Yes, Off)},
54
54
  ),
55
55
  Checkbox,
@@ -8,7 +8,8 @@ from typing import BinaryIO, Dict, List, Tuple, Union
8
8
 
9
9
  from .adapter import fp_or_f_obj_or_stream_to_stream
10
10
  from .constants import (DEFAULT_FONT, DEFAULT_FONT_COLOR, DEFAULT_FONT_SIZE,
11
- VERSION_IDENTIFIER_PREFIX, VERSION_IDENTIFIERS)
11
+ NEW_LINE_SYMBOL, VERSION_IDENTIFIER_PREFIX,
12
+ VERSION_IDENTIFIERS)
12
13
  from .coordinate import generate_coordinate_grid
13
14
  from .filler import fill, simple_fill
14
15
  from .font import register_font
@@ -244,6 +245,9 @@ class PdfWrapper(FormWrapper):
244
245
  new_widget.font_size = kwargs.get("font_size", DEFAULT_FONT_SIZE)
245
246
  new_widget.font_color = kwargs.get("font_color", DEFAULT_FONT_COLOR)
246
247
 
248
+ if NEW_LINE_SYMBOL in text:
249
+ new_widget.text_lines = text.split(NEW_LINE_SYMBOL)
250
+
247
251
  watermarks = create_watermarks_and_draw(
248
252
  self.stream,
249
253
  page_number,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPDFForm
3
- Version: 1.4.28
3
+ Version: 1.4.30
4
4
  Summary: The Python library for PDF forms.
5
5
  Home-page: https://github.com/chinapandaman/PyPDFForm
6
6
  Author: Jinge Li
@@ -83,12 +83,6 @@ and it should look like [this](https://github.com/chinapandaman/PyPDFForm/raw/ma
83
83
 
84
84
  The official documentation can be found on [the GitHub page](https://chinapandaman.github.io/PyPDFForm/) of this repository.
85
85
 
86
- ## Public Speak
86
+ ## Other Resources
87
87
 
88
88
  [Chicago Python User Group - Dec 14, 2023](https://youtu.be/8t1RdAKwr9w?si=TLgumBNXv9H8szSn)
89
-
90
- ## How to Contribute
91
-
92
- It is difficult to make sure that the library supports all the PDF form creating tools out
93
- there. So if you run into a case where the library does not work for certain PDF forms created by certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
94
- to make the library support the attached PDF form as well as the tool used to create it.
@@ -57,12 +57,6 @@ and it should look like [this](https://github.com/chinapandaman/PyPDFForm/raw/ma
57
57
 
58
58
  The official documentation can be found on [the GitHub page](https://chinapandaman.github.io/PyPDFForm/) of this repository.
59
59
 
60
- ## Public Speak
60
+ ## Other Resources
61
61
 
62
62
  [Chicago Python User Group - Dec 14, 2023](https://youtu.be/8t1RdAKwr9w?si=TLgumBNXv9H8szSn)
63
-
64
- ## How to Contribute
65
-
66
- It is difficult to make sure that the library supports all the PDF form creating tools out
67
- there. So if you run into a case where the library does not work for certain PDF forms created by certain tools, feel free to open an issue with the problematic PDF form attached. I will seek
68
- to make the library support the attached PDF form as well as the tool used to create it.
@@ -222,6 +222,27 @@ def test_draw_text_on_one_page(template_stream, pdf_samples, request):
222
222
  assert obj.stream == expected
223
223
 
224
224
 
225
+ def test_draw_text_new_line_symbol(template_stream, pdf_samples, request):
226
+ expected_path = os.path.join(
227
+ pdf_samples, "sample_pdf_with_drawn_text_new_line_symbol.pdf"
228
+ )
229
+ with open(expected_path, "rb+") as f:
230
+ obj = PdfWrapper(template_stream).draw_text(
231
+ "test\ntest\ntest",
232
+ 1,
233
+ 300,
234
+ 225,
235
+ )
236
+
237
+ request.config.results["expected_path"] = expected_path
238
+ request.config.results["stream"] = obj.read()
239
+
240
+ expected = f.read()
241
+
242
+ assert len(obj.stream) == len(expected)
243
+ assert obj.stream == expected
244
+
245
+
225
246
  def test_draw_image_on_one_page(template_stream, image_samples, pdf_samples, request):
226
247
  expected_path = os.path.join(pdf_samples, "sample_pdf_with_image.pdf")
227
248
  with open(expected_path, "rb+") as f:
File without changes
File without changes
File without changes
File without changes