first commit

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
陈辅元
2026-07-16 11:12:17 +08:00
co-authored by Cursor
commit 4003624b8c
80 changed files with 9990 additions and 0 deletions
@@ -0,0 +1,16 @@
"""Document standardization for PDF input."""
from __future__ import annotations
from pathlib import Path
import fitz
def open_document(path: Path) -> fitz.Document:
"""Open and normalize a PDF for downstream layout processing."""
doc = fitz.open(path)
if doc.is_encrypted and not doc.authenticate(""):
doc.close()
raise ValueError(f"Encrypted PDF cannot be opened: {path.name}")
return doc