elements_json JSONB: структура документа в БД, PDF page, v1.12

This commit is contained in:
2026-06-17 08:22:33 +04:00
parent 30460cc78c
commit f66d188551
4 changed files with 12 additions and 5 deletions
+3
View File
@@ -128,6 +128,7 @@ def _parse_pdf(file_bytes: bytes) -> dict:
with pdfplumber.open(io.BytesIO(file_bytes)) as pdf:
for page in pdf.pages:
pn = page.page_number
# Текст страницы
text = page.extract_text()
if text:
@@ -138,6 +139,7 @@ def _parse_pdf(file_bytes: bytes) -> dict:
"type": "paragraph",
"style": "",
"text": line,
"page": pn,
})
# Таблицы на странице
@@ -147,6 +149,7 @@ def _parse_pdf(file_bytes: bytes) -> dict:
result["elements"].append({
"type": "table",
"rows": tbl,
"page": pn,
})
except Exception as e: