Spaces:
Running
Running
Download pdf_to_text.py from TangSan003/OCRSpellCorrection: direct link, hf CLI and curl.
- Browser
- Download file 237 Bytes
-
https://huggingface.co/spaces/TangSan003/OCRSpellCorrection/resolve/main/pdf_to_text.py
- Command line
-
hf download hf://spaces/TangSan003/OCRSpellCorrection/pdf_to_text.py
-
curl -L -o pdf_to_text.py https://huggingface.co/spaces/TangSan003/OCRSpellCorrection/resolve/main/pdf_to_text.py
237 Bytes
| import pymupdf | |
| import re | |
| doc = pymupdf.open("cv.pdf") # open a document | |
| full_text = "" | |
| for page in doc: # iterate the document pages | |
| full_text += page.get_text() # | |
| full_text = re.sub(r'\n(?![A-Z])', ' ', full_text) | |
| print(full_text) |