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

Method extractDICT

src/__init__.py:16471–16481  ·  view source on GitHub ↗

Return page content as a Python dict of images and text spans.

(self, cb=None, sort=False)

Source from the content-addressed store, hash-verified

16469 return lines
16470
16471 def extractDICT(self, cb=None, sort=False) -> dict:
16472 """Return page content as a Python dict of images and text spans."""
16473 val = self._textpage_dict(raw=False)
16474 if cb is not None:
16475 val["width"] = cb.width
16476 val["height"] = cb.height
16477 if sort:
16478 blocks = val["blocks"]
16479 blocks.sort(key=lambda b: (b["bbox"][3], b["bbox"][0]))
16480 val["blocks"] = blocks
16481 return val
16482
16483 def extractHTML(self) -> str:
16484 """Return page content as a HTML string."""

Callers 3

test_extendable_textpageFunction · 0.95
get_textFunction · 0.80
get_textFunction · 0.80

Calls 1

_textpage_dictMethod · 0.95

Tested by 1

test_extendable_textpageFunction · 0.76