Add annotation content editing from side panel
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user