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

Function _test_extract2

tests/test_textextract.py:37–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 text = pymupdf.ConversionTrailer("xml")
36
37def _test_extract2():
38 import sys
39 import time
40 path = f'{scriptdir}/../../PyMuPDF-performance/adobe.pdf'
41 if not os.path.exists(path):
42 print(f'test_extract2(): not running because does not exist: {path}')
43 return
44 doc = pymupdf.open( path)
45 for opt in (
46 'dict',
47 'dict2',
48 'text',
49 'blocks',
50 'words',
51 'html',
52 'xhtml',
53 'xml',
54 'json',
55 'rawdict',
56 'rawjson',
57 ):
58 for flags in None, pymupdf.TEXTFLAGS_TEXT:
59 t0 = time.time()
60 for page in doc:
61 page.get_text(opt, flags=flags)
62 t = time.time() - t0
63 print(f't={t:.02f}: opt={opt} flags={flags}')
64 sys.stdout.flush()
65
66def _test_extract3():
67 import sys

Callers

nothing calls this directly

Calls 2

flushMethod · 0.80
get_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…