pdfdancer-client-python 0.2.18__tar.gz → 0.2.20__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.
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/PKG-INFO +1 -1
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/pyproject.toml +1 -1
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/__init__.py +2 -0
- pdfdancer_client_python-0.2.20/src/pdfdancer/image_builder.py +60 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/models.py +446 -35
- pdfdancer_client_python-0.2.20/src/pdfdancer/page_builder.py +92 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/path_builder.py +252 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/pdfdancer_v1.py +52 -18
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/types.py +7 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer_client_python.egg-info/PKG-INFO +1 -1
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer_client_python.egg-info/SOURCES.txt +3 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/__init__.py +1 -1
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_image.py +34 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_new_pdf.py +1 -1
- pdfdancer_client_python-0.2.20/tests/e2e/test_page.py +185 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_paragraph.py +122 -0
- pdfdancer_client_python-0.2.20/tests/e2e/test_path_builder_rectangle.py +568 -0
- pdfdancer_client_python-0.2.20/tests/e2e/test_rectangle_builder.py +504 -0
- pdfdancer_client_python-0.2.18/src/pdfdancer/image_builder.py +0 -30
- pdfdancer_client_python-0.2.18/tests/e2e/test_page.py +0 -66
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/.claude/commands/discuss.md +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/.github/workflows/ci.yml +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/.gitignore +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/CLAUDE.md +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/LICENSE +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/NOTICE +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/README.md +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/TODO.md +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/docs/openapi.yml +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/release.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/setup.cfg +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/exceptions.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/fingerprint.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer/paragraph_builder.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer_client_python.egg-info/dependency_links.txt +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer_client_python.egg-info/requires.txt +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/src/pdfdancer_client_python.egg-info/top_level.txt +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/test.sh +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/__init__.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/conftest.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/pdf_assertions.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_acroform.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_bezier_builder.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_context_manager.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_form_x_objects.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_line.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_line_builder.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_path.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_path_builder.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_path_comprehensive.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_pdfdancer.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_positioning.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/e2e/test_snapshot.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/DancingScript-Regular.ttf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/Empty.pdf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/JetBrainsMono-Regular.ttf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/ObviouslyAwesome.pdf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/basic-paths.pdf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/form-xobject-example.pdf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/logo-80.png +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/fixtures/mixed-form-types.pdf +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_anonymous_token.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_fingerprint.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_models.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_openapi_compliance.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_path_models.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_pdf_object_equality.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/tests/test_standard_fonts.py +0 -0
- {pdfdancer_client_python-0.2.18 → pdfdancer_client_python-0.2.20}/update-api-spec.sh +0 -0
|
@@ -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",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from pdfdancer import ValidationException, Image, Position
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ImageBuilder:
|
|
7
|
+
|
|
8
|
+
def __init__(self, client: 'PDFDancer'):
|
|
9
|
+
"""
|
|
10
|
+
Initialize the image builder with a client reference.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
client: The PDFDancer instance for font registration
|
|
14
|
+
"""
|
|
15
|
+
if client is None:
|
|
16
|
+
raise ValidationException("Client cannot be null")
|
|
17
|
+
|
|
18
|
+
self._client = client
|
|
19
|
+
self._image = Image()
|
|
20
|
+
|
|
21
|
+
def from_file(self, img_path: Path) -> 'ImageBuilder':
|
|
22
|
+
self._image.data = img_path.read_bytes()
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def at(self, page, x, y) -> 'ImageBuilder':
|
|
26
|
+
self._image.position = Position.at_page_coordinates(page, x, y)
|
|
27
|
+
return self
|
|
28
|
+
|
|
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
|
|
60
|
+
return self._client._add_image(self._image, self._image.position)
|