pdfdancer-client-python 0.2.6__py3-none-any.whl → 0.2.7__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/pdfdancer_v1.py +20 -8
- pdfdancer/types.py +0 -7
- {pdfdancer_client_python-0.2.6.dist-info → pdfdancer_client_python-0.2.7.dist-info}/METADATA +1 -1
- {pdfdancer_client_python-0.2.6.dist-info → pdfdancer_client_python-0.2.7.dist-info}/RECORD +6 -6
- {pdfdancer_client_python-0.2.6.dist-info → pdfdancer_client_python-0.2.7.dist-info}/WHEEL +0 -0
- {pdfdancer_client_python-0.2.6.dist-info → pdfdancer_client_python-0.2.7.dist-info}/top_level.txt +0 -0
pdfdancer/pdfdancer_v1.py
CHANGED
|
@@ -26,13 +26,16 @@ from .models import (
|
|
|
26
26
|
FindRequest, DeleteRequest, MoveRequest, AddRequest, ModifyRequest, ModifyTextRequest, ChangeFormFieldRequest,
|
|
27
27
|
ShapeType, PositionMode
|
|
28
28
|
)
|
|
29
|
-
from .types import PathObject, ParagraphObject, TextLineObject, ImageObject, FormObject, FormFieldObject
|
|
29
|
+
from .types import PathObject, ParagraphObject, TextLineObject, ImageObject, FormObject, FormFieldObject
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class PageClient:
|
|
33
33
|
def __init__(self, page_index: int, root: "PDFDancer"):
|
|
34
34
|
self.page_index = page_index
|
|
35
35
|
self.root = root
|
|
36
|
+
self.object_type = ObjectType.PAGE
|
|
37
|
+
self.position = Position.at_page(page_index)
|
|
38
|
+
self.internal_id = f"PAGE-{page_index}"
|
|
36
39
|
|
|
37
40
|
def select_paths_at(self, x: float, y: float) -> List[PathObject]:
|
|
38
41
|
# noinspection PyProtectedMember
|
|
@@ -99,8 +102,17 @@ class PageClient:
|
|
|
99
102
|
# noinspection PyProtectedMember
|
|
100
103
|
return self.root._to_form_field_objects(self.root._find_form_fields(position))
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_ref(cls, root: 'PDFDancer', object_ref: ObjectRef) -> 'PageClient':
|
|
107
|
+
page_client = PageClient(page_index=object_ref.position.page_index, root=root)
|
|
108
|
+
return page_client
|
|
109
|
+
|
|
110
|
+
def delete(self) -> bool:
|
|
111
|
+
# noinspection PyProtectedMember
|
|
112
|
+
return self.root._delete_page(self._ref())
|
|
113
|
+
|
|
114
|
+
def _ref(self):
|
|
115
|
+
return ObjectRef(internal_id=self.internal_id, position=self.position, type=self.object_type)
|
|
104
116
|
|
|
105
117
|
|
|
106
118
|
class PDFDancer:
|
|
@@ -472,7 +484,7 @@ class PDFDancer:
|
|
|
472
484
|
|
|
473
485
|
# Page Operations
|
|
474
486
|
|
|
475
|
-
def pages(self) -> List[
|
|
487
|
+
def pages(self) -> List[PageClient]:
|
|
476
488
|
return self._to_page_objects(self._get_pages())
|
|
477
489
|
|
|
478
490
|
def _get_pages(self) -> List[ObjectRef]:
|
|
@@ -898,8 +910,8 @@ class PDFDancer:
|
|
|
898
910
|
return [FormFieldObject(self, ref.internal_id, ref.type, ref.position, ref.name, ref.value) for ref in
|
|
899
911
|
path_refs]
|
|
900
912
|
|
|
901
|
-
def _to_page_objects(self, path_refs: List[ObjectRef]) -> List[
|
|
902
|
-
return [
|
|
913
|
+
def _to_page_objects(self, path_refs: List[ObjectRef]) -> List[PageClient]:
|
|
914
|
+
return [PageClient.from_ref(self, ref) for ref in path_refs]
|
|
903
915
|
|
|
904
|
-
def _to_page_object(self, ref: ObjectRef) ->
|
|
905
|
-
return
|
|
916
|
+
def _to_page_object(self, ref: ObjectRef) -> PageClient:
|
|
917
|
+
return PageClient.from_ref(self, ref)
|
pdfdancer/types.py
CHANGED
|
@@ -239,10 +239,3 @@ class FormFieldObject(PDFObjectBase):
|
|
|
239
239
|
ref.name = self.name
|
|
240
240
|
ref.value = self.value
|
|
241
241
|
return ref
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
class PageObject(PDFObjectBase):
|
|
245
|
-
|
|
246
|
-
def delete(self) -> bool:
|
|
247
|
-
# noinspection PyProtectedMember
|
|
248
|
-
return self._client._delete_page(self.object_ref())
|
|
@@ -3,9 +3,9 @@ pdfdancer/exceptions.py,sha256=Y5zwNVZprsv2hvKX304cXWobJt11nrEhCzLklu2wiO8,1567
|
|
|
3
3
|
pdfdancer/image_builder.py,sha256=Omxc2LcieJ1MbvWBXR5_sfia--eAucTUe0KWgr22HYo,842
|
|
4
4
|
pdfdancer/models.py,sha256=SmkKScr47uVs6FCWUAVIg6rucYrYHvbIxZngyA50XyI,15498
|
|
5
5
|
pdfdancer/paragraph_builder.py,sha256=bAfwX9U2YT1UGX9EKkPnGYvGK3SQP3X1ocxlgyLE_rU,8872
|
|
6
|
-
pdfdancer/pdfdancer_v1.py,sha256=
|
|
7
|
-
pdfdancer/types.py,sha256=
|
|
8
|
-
pdfdancer_client_python-0.2.
|
|
9
|
-
pdfdancer_client_python-0.2.
|
|
10
|
-
pdfdancer_client_python-0.2.
|
|
11
|
-
pdfdancer_client_python-0.2.
|
|
6
|
+
pdfdancer/pdfdancer_v1.py,sha256=OP_QfJrBzJ2B6RLlmEnbq9d8jlA6A22tRvwvVuzgUUM,35964
|
|
7
|
+
pdfdancer/types.py,sha256=TtXbOqa8febqTUmYF97tq-y6i-jNuO6UHvmAmSJHz20,7466
|
|
8
|
+
pdfdancer_client_python-0.2.7.dist-info/METADATA,sha256=-cHYC8DD2bQHku_e3g7O8kxk7aYzMVYrhX2MaO6rSJI,6769
|
|
9
|
+
pdfdancer_client_python-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
pdfdancer_client_python-0.2.7.dist-info/top_level.txt,sha256=ICwSVRpcCKrdBF9QlaX9Y0e_N3Nk1p7QVxadGOnbxeY,10
|
|
11
|
+
pdfdancer_client_python-0.2.7.dist-info/RECORD,,
|
|
File without changes
|
{pdfdancer_client_python-0.2.6.dist-info → pdfdancer_client_python-0.2.7.dist-info}/top_level.txt
RENAMED
|
File without changes
|