aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGeorgeFI2023-09-25 21:12:26 +0200
committerGeorgeFI2023-09-25 21:12:26 +0200
commit498308a737943b87ecbf38a05404d4caa22fa726 (patch)
tree3f1fcf4264f493da46dcb24a8ea21024c502ccbd /src
parent0eaf610cfe6a0a36cfad2fa71b42d1f921b6e49b (diff)
downloadsec-certs-498308a737943b87ecbf38a05404d4caa22fa726.tar.gz
sec-certs-498308a737943b87ecbf38a05404d4caa22fa726.tar.zst
sec-certs-498308a737943b87ecbf38a05404d4caa22fa726.zip
fix: OCR with Pytesseract fixed now
Diffstat (limited to 'src')
-rw-r--r--src/sec_certs/utils/pdf.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sec_certs/utils/pdf.py b/src/sec_certs/utils/pdf.py
index b4ec1e94..7736b5d0 100644
--- a/src/sec_certs/utils/pdf.py
+++ b/src/sec_certs/utils/pdf.py
@@ -12,6 +12,7 @@ from typing import Any
import pdftotext
import pikepdf
import pytesseract
+from PIL import Image
from sec_certs import constants
from sec_certs.constants import (
@@ -55,7 +56,7 @@ def ocr_pdf_file(pdf_path: Path) -> str:
for ppm_path in map(Path, glob.glob(str(tmppath / "image*.ppm"))):
base = ppm_path.with_suffix("")
- content = pytesseract.image_to_string(ppm_path, lang="eng+deu+fra")
+ content = pytesseract.image_to_string(Image.open(ppm_path), lang="eng+deu+fra")
if content:
with Path(base.with_suffix(".txt")).open("w") as file: