Add annotation content editing from side panel

This commit is contained in:
2026-06-30 14:08:18 +08:00
parent e61d078ca3
commit 2ffc9a4c92
3 changed files with 54 additions and 3 deletions
+15
View File
@@ -565,6 +565,21 @@ class PdfDocument:
rect = annot.rect + (dx, dy, dx, dy)
return self.update_annotation_rect(page_index, xref, self._rect_tuple(rect))
def update_annotation_content(self, page_index: int, xref: int, content: str) -> bool:
if not self._annotation(page_index, xref):
return False
self.snapshot()
page = self._page(page_index)
annot = page.first_annot
while annot:
if annot.xref == xref:
annot.set_info(content=content)
annot.update()
self.mark_changed()
return True
annot = annot.next
return False
def delete_annotation(self, page_index: int, xref: int) -> bool:
page = self._page(page_index)
annot = page.first_annot