Skip to content

Silly Questions #890

Feb 8, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hope I understood well:
To keep the sequence of annotations in reading sequence, you have two options:

  1. If you compute the rectangles via text searching (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.
  2. You can also sort the annotations instead:
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

how do I open a pdf to a certain page using file URI?

Won't work. PyMuPDF is not a viewer like Adobe Acrobat, but a programming libray. You must first make a document, bef…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dummifiedme
Comment options

@JorjMcKie
Comment options

Answer selected by JorjMcKie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants