Silly Questions #890
-
Hi again,
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hope I understood well:
annots = [a for a in page.annots()]
annots.sort(key=lambda a: (a.rect.bl.y, a.rect.bl.x))
# now loop through the sorted list of annotations
Won't work. PyMuPDF is not a viewer like Adobe Acrobat, but a programming libray. You must first make a document, before you can load a page. def opener(filename, pno):
doc = fitz.open(filename)
page = doc[pno]
return doc, page
doc, page = opener("somefile.pdf", 3) Or something like that. |
Beta Was this translation helpful? Give feedback.
Hope I understood well:
To keep the sequence of annotations in reading sequence, you have two options:
page.search_for()
), sort those rectangles before you make the annotations. Sorting rectangles means: pick a rectangle corner (e.g. bottom left one), and then sort by (y, x) coordinates.Won't work. PyMuPDF is not a viewer like Adobe Acrobat, but a programming libray. You must first make a document, bef…