pdfdancer-client-python 0.2.28__py3-none-any.whl → 0.2.29__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.
- pdfdancer/types.py +52 -13
- {pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/METADATA +1 -1
- {pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/RECORD +7 -7
- {pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/WHEEL +0 -0
- {pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/licenses/LICENSE +0 -0
- {pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/licenses/NOTICE +0 -0
- {pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/top_level.txt +0 -0
pdfdancer/types.py
CHANGED
|
@@ -160,14 +160,14 @@ class BaseTextEdit:
|
|
|
160
160
|
|
|
161
161
|
class TextLineEdit(BaseTextEdit):
|
|
162
162
|
def apply(self) -> bool:
|
|
163
|
-
#
|
|
163
|
+
# Line spacing is NOT supported for text lines - fail hard
|
|
164
164
|
if self._line_spacing is not None:
|
|
165
|
-
|
|
166
|
-
"
|
|
167
|
-
|
|
165
|
+
raise UnsupportedOperation(
|
|
166
|
+
"Line spacing changes are not supported for individual text lines. "
|
|
167
|
+
"Line spacing can only be modified on paragraphs, not individual text lines."
|
|
168
168
|
)
|
|
169
169
|
|
|
170
|
-
#
|
|
170
|
+
# If only text changed (no font, color, or position), use simple text modification
|
|
171
171
|
only_text_changed = (
|
|
172
172
|
self._new_text is not None
|
|
173
173
|
and self._font_name is None
|
|
@@ -185,7 +185,7 @@ class TextLineEdit(BaseTextEdit):
|
|
|
185
185
|
print(f"WARNING: {result.warning}", file=sys.stderr)
|
|
186
186
|
return result
|
|
187
187
|
|
|
188
|
-
#
|
|
188
|
+
# If only position changed (move operation)
|
|
189
189
|
only_move = (
|
|
190
190
|
self._position is not None
|
|
191
191
|
and self._new_text is None
|
|
@@ -216,15 +216,54 @@ class TextLineEdit(BaseTextEdit):
|
|
|
216
216
|
result = self._target_obj._client._move(self._object_ref, position)
|
|
217
217
|
return result
|
|
218
218
|
|
|
219
|
-
#
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"To modify text styling, please modify the parent paragraph instead."
|
|
219
|
+
# For font/color changes or combined operations, use TextLineBuilder
|
|
220
|
+
# This ensures proper handling of font/color fallbacks just like ParagraphEditSession
|
|
221
|
+
from .text_line_builder import TextLineBuilder
|
|
222
|
+
|
|
223
|
+
builder = TextLineBuilder.from_object_ref(
|
|
224
|
+
self._target_obj._client, self._object_ref
|
|
226
225
|
)
|
|
227
226
|
|
|
227
|
+
# Apply modifications to builder
|
|
228
|
+
# IMPORTANT: Always explicitly set text to ensure it's preserved
|
|
229
|
+
if self._new_text is not None:
|
|
230
|
+
builder.text(self._new_text)
|
|
231
|
+
elif hasattr(self._object_ref, "text") and self._object_ref.text:
|
|
232
|
+
# Preserve original text when only changing font/color/position
|
|
233
|
+
builder.text(self._object_ref.text)
|
|
234
|
+
|
|
235
|
+
# IMPORTANT: Always explicitly set font to ensure it's preserved
|
|
236
|
+
if self._font_name is not None and self._font_size is not None:
|
|
237
|
+
builder.font(self._font_name, self._font_size)
|
|
238
|
+
elif hasattr(self._object_ref, "font_name") and hasattr(self._object_ref, "font_size"):
|
|
239
|
+
if self._object_ref.font_name and self._object_ref.font_size:
|
|
240
|
+
# Preserve original font when only changing color/position
|
|
241
|
+
builder.font(self._object_ref.font_name, self._object_ref.font_size)
|
|
242
|
+
|
|
243
|
+
if self._color is not None:
|
|
244
|
+
builder.color(self._color)
|
|
245
|
+
if self._position is not None:
|
|
246
|
+
x = self._position.x()
|
|
247
|
+
y = self._position.y()
|
|
248
|
+
if x is None or y is None:
|
|
249
|
+
raise ValidationException("Position must have x and y coordinates")
|
|
250
|
+
page_index = (
|
|
251
|
+
self._object_ref.position.page_index
|
|
252
|
+
if self._object_ref.position
|
|
253
|
+
else None
|
|
254
|
+
)
|
|
255
|
+
if page_index is None:
|
|
256
|
+
raise ValidationException(
|
|
257
|
+
"Text line position must include a page index"
|
|
258
|
+
)
|
|
259
|
+
builder.at(page_index, x, y)
|
|
260
|
+
|
|
261
|
+
# Use builder's modify method which handles all the complexity
|
|
262
|
+
result = builder.modify(self._object_ref)
|
|
263
|
+
if result.warning:
|
|
264
|
+
print(f"WARNING: {result.warning}", file=sys.stderr)
|
|
265
|
+
return result
|
|
266
|
+
|
|
228
267
|
|
|
229
268
|
class ParagraphObject(PDFObjectBase):
|
|
230
269
|
"""Represents a paragraph text block inside a PDF page."""
|
{pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/RECORD
RENAMED
|
@@ -8,10 +8,10 @@ pdfdancer/paragraph_builder.py,sha256=yXdn2hoxpJYcUVAmSEOgoq-ApGIe9k9GWkokIIQWIJ
|
|
|
8
8
|
pdfdancer/path_builder.py,sha256=2w0LPJo1u8bSjGAbYevTtOF4VD8M9B4SLe_wSLIYJx8,23917
|
|
9
9
|
pdfdancer/pdfdancer_v1.py,sha256=gaI9oDq8lksEi4DJAiZNebnj5XVFB8lYtGFw-ziTZTw,119130
|
|
10
10
|
pdfdancer/text_line_builder.py,sha256=74zc9wDPtSngHVGz_ykB3Bci_rEcwLr0dXGSEbLH5eo,10262
|
|
11
|
-
pdfdancer/types.py,sha256
|
|
12
|
-
pdfdancer_client_python-0.2.
|
|
13
|
-
pdfdancer_client_python-0.2.
|
|
14
|
-
pdfdancer_client_python-0.2.
|
|
15
|
-
pdfdancer_client_python-0.2.
|
|
16
|
-
pdfdancer_client_python-0.2.
|
|
17
|
-
pdfdancer_client_python-0.2.
|
|
11
|
+
pdfdancer/types.py,sha256=-ROafuR_GqLi0wUQTXTn2q3MXKPnWLsMoG8L9-Vdva4,16794
|
|
12
|
+
pdfdancer_client_python-0.2.29.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
13
|
+
pdfdancer_client_python-0.2.29.dist-info/licenses/NOTICE,sha256=xaC4l-IChAmtViNDie8ZWzUk0O6XRMyzOl0zLmVZ2HE,232
|
|
14
|
+
pdfdancer_client_python-0.2.29.dist-info/METADATA,sha256=scuZlRE6H0p15sHbjUDKBgmvkqVZWpHKMsyTMqtNAI4,24729
|
|
15
|
+
pdfdancer_client_python-0.2.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
pdfdancer_client_python-0.2.29.dist-info/top_level.txt,sha256=ICwSVRpcCKrdBF9QlaX9Y0e_N3Nk1p7QVxadGOnbxeY,10
|
|
17
|
+
pdfdancer_client_python-0.2.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.2.28.dist-info → pdfdancer_client_python-0.2.29.dist-info}/top_level.txt
RENAMED
|
File without changes
|