pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
https://pymupdf.readthedocs.io
GNU Affero General Public License v3.0
4.49k stars 443 forks source link

Updating Annotations #3576

Closed tobiasspiegltec closed 2 weeks ago

tobiasspiegltec commented 2 weeks ago

Description of the bug

I have a script that copies information from annots to create identical ones on other pages.

This works great, however, the annots appear weird when opening the PDF document. It can be seen, that the annots have the correct information, but to show the correct appearance, I need to change any property of the annot (and then change it back) I think that the issue has something to do with updating, however updating the annot and the page doesn't work. Is there a solution to this problem?

How to reproduce the bug

The following methods are used:

the low level information is copied using doc.xref_object(xref) a "dummy" annot is created using page.add_rect_annot() (or any other annot) the annot is updated with the information using doc.update_object()

PyMuPDF version

1.24.2

Operating system

Windows

Python version

3.11

JorjMcKie commented 2 weeks ago

This is not a bug / issue but a Discussions item. Transferring to there ...