pdfdancer-client-python 0.2.19__py3-none-any.whl → 0.2.21__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 pdfdancer-client-python might be problematic. Click here for more details.
- pdfdancer/__init__.py +2 -0
- pdfdancer/image_builder.py +30 -0
- pdfdancer/models.py +545 -58
- pdfdancer/page_builder.py +92 -0
- pdfdancer/paragraph_builder.py +392 -177
- pdfdancer/path_builder.py +252 -0
- pdfdancer/pdfdancer_v1.py +61 -22
- pdfdancer/types.py +112 -103
- {pdfdancer_client_python-0.2.19.dist-info → pdfdancer_client_python-0.2.21.dist-info}/METADATA +1 -1
- pdfdancer_client_python-0.2.21.dist-info/RECORD +16 -0
- pdfdancer_client_python-0.2.19.dist-info/RECORD +0 -15
- {pdfdancer_client_python-0.2.19.dist-info → pdfdancer_client_python-0.2.21.dist-info}/WHEEL +0 -0
- {pdfdancer_client_python-0.2.19.dist-info → pdfdancer_client_python-0.2.21.dist-info}/licenses/LICENSE +0 -0
- {pdfdancer_client_python-0.2.19.dist-info → pdfdancer_client_python-0.2.21.dist-info}/licenses/NOTICE +0 -0
- {pdfdancer_client_python-0.2.19.dist-info → pdfdancer_client_python-0.2.21.dist-info}/top_level.txt +0 -0
pdfdancer/__init__.py
CHANGED
|
@@ -16,12 +16,14 @@ from .models import (
|
|
|
16
16
|
FontType, PathSegment, Line, Bezier, Path
|
|
17
17
|
)
|
|
18
18
|
from .paragraph_builder import ParagraphBuilder
|
|
19
|
+
from .page_builder import PageBuilder
|
|
19
20
|
from .path_builder import PathBuilder, LineBuilder, BezierBuilder
|
|
20
21
|
|
|
21
22
|
__version__ = "1.0.0"
|
|
22
23
|
__all__ = [
|
|
23
24
|
"PDFDancer",
|
|
24
25
|
"ParagraphBuilder",
|
|
26
|
+
"PageBuilder",
|
|
25
27
|
"PathBuilder",
|
|
26
28
|
"LineBuilder",
|
|
27
29
|
"BezierBuilder",
|
pdfdancer/image_builder.py
CHANGED
|
@@ -27,4 +27,34 @@ class ImageBuilder:
|
|
|
27
27
|
return self
|
|
28
28
|
|
|
29
29
|
def add(self) -> bool:
|
|
30
|
+
# noinspection PyProtectedMember
|
|
31
|
+
return self._client._add_image(self._image, self._image.position)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ImageOnPageBuilder:
|
|
35
|
+
|
|
36
|
+
def __init__(self, client: 'PDFDancer', page_index: int):
|
|
37
|
+
"""
|
|
38
|
+
Initialize the image builder with a client reference.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
client: The PDFDancer instance for font registration
|
|
42
|
+
"""
|
|
43
|
+
if client is None:
|
|
44
|
+
raise ValidationException("Client cannot be null")
|
|
45
|
+
|
|
46
|
+
self._client = client
|
|
47
|
+
self._image = Image()
|
|
48
|
+
self._page_index = page_index
|
|
49
|
+
|
|
50
|
+
def from_file(self, img_path: Path) -> 'ImageOnPageBuilder':
|
|
51
|
+
self._image.data = img_path.read_bytes()
|
|
52
|
+
return self
|
|
53
|
+
|
|
54
|
+
def at(self, x, y) -> 'ImageOnPageBuilder':
|
|
55
|
+
self._image.position = Position.at_page_coordinates(self._page_index, x, y)
|
|
56
|
+
return self
|
|
57
|
+
|
|
58
|
+
def add(self) -> bool:
|
|
59
|
+
# noinspection PyProtectedMember
|
|
30
60
|
return self._client._add_image(self._image, self._image.position)
|