You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
263 B

import fitz
import re
doc = fitz.open("test.pdf")
index_page = doc[0]
blocks = index_page.get_text("blocks")
for block in blocks:
text = block[4].strip()
print(int(text))
match = re.search(r'(\d+)', text)
if match:
print(match.group(1))