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

Method extractRAWDICT

src/__init__.py:16557–16567  ·  view source on GitHub ↗

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

(self, cb=None, sort=False)

Source from the content-addressed store, hash-verified

16555 return val
16556
16557 def extractRAWDICT(self, cb=None, sort=False) -> dict:
16558 """Return page content as a Python dict of images and text characters."""
16559 val = self._textpage_dict(raw=True)
16560 if cb is not None:
16561 val["width"] = cb.width
16562 val["height"] = cb.height
16563 if sort:
16564 blocks = val["blocks"]
16565 blocks.sort(key=lambda b: (b["bbox"][3], b["bbox"][0]))
16566 val["blocks"] = blocks
16567 return val
16568
16569 def extractRAWJSON(self, cb=None, sort=False) -> str:
16570 """Return 'extractRAWDICT' converted to JSON format."""

Callers 3

get_textFunction · 0.80
extract_cellsFunction · 0.80
get_textFunction · 0.80

Calls 1

_textpage_dictMethod · 0.95

Tested by

no test coverage detected