Select new text objects after adding

This commit is contained in:
2026-06-30 16:54:39 +08:00
parent 8ce0c733bc
commit 6b3a90a6e9
3 changed files with 25 additions and 4 deletions
+8 -1
View File
@@ -206,7 +206,7 @@ class PdfDocument:
page_index: int,
text: str,
point: tuple[float, float] | None = None,
) -> None:
) -> AnnotationInfo:
self.snapshot()
page = self._page(page_index)
x0, y0 = point or (72, 96)
@@ -226,6 +226,13 @@ class PdfDocument:
annot.set_info(content=text)
annot.update()
self.mark_changed()
return AnnotationInfo(
page_index=page_index,
xref=annot.xref,
annotation_type=annot.type[1],
content=text,
rect=self._rect_tuple(annot.rect),
)
def add_text_stamp(
self,