Wrapper for mupdf.pdf_annot_page() which raises an exception if is not bound to a page instead of returning a mupdf.PdfPage with `.m_internal=None`. [Some other MuPDF functions such as pdf_update_annot()` already raise a similar exception if a pdf_annot's .page field is
(annot)
| 561 | |
| 562 | |
| 563 | def _pdf_annot_page(annot): |
| 564 | ''' |
| 565 | Wrapper for mupdf.pdf_annot_page() which raises an exception if <annot> |
| 566 | is not bound to a page instead of returning a mupdf.PdfPage with |
| 567 | `.m_internal=None`. |
| 568 | |
| 569 | [Some other MuPDF functions such as pdf_update_annot()` already raise a |
| 570 | similar exception if a pdf_annot's .page field is null.] |
| 571 | ''' |
| 572 | page = mupdf.pdf_annot_page(annot) |
| 573 | if not page.m_internal: |
| 574 | raise RuntimeError('Annot is not bound to a page') |
| 575 | return page |
| 576 | |
| 577 | |
| 578 | # Fixme: we don't support JM_MEMORY=1. |
no outgoing calls
no test coverage detected
searching dependent graphs…