MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / get_text_selection

Function get_text_selection

src_classic/utils.py:591–607  ·  view source on GitHub ↗
(
    page: Page,
    p1: point_like,
    p2: point_like,
    clip: rect_like = None,
    textpage: TextPage = None,
)

Source from the content-addressed store, hash-verified

589
590
591def get_text_selection(
592 page: Page,
593 p1: point_like,
594 p2: point_like,
595 clip: rect_like = None,
596 textpage: TextPage = None,
597):
598 CheckParent(page)
599 tp = textpage
600 if tp is None:
601 tp = page.get_textpage(clip=clip, flags=TEXT_DEHYPHENATE)
602 elif getattr(tp, "parent") != page:
603 raise ValueError("not a textpage of this page")
604 rc = tp.extractSelection(p1, p2)
605 if textpage is None:
606 del tp
607 return rc
608
609
610def get_textpage_ocr(

Callers

nothing calls this directly

Calls 3

CheckParentFunction · 0.85
extractSelectionMethod · 0.80
get_textpageMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…