auto-swe-agent-ui / docstream /core /extractor_v2.py
DevilBits's picture
fix: enforce safe empty bounds for tracking data charts and match dataframe list alignments
6085b61
raw
history blame contribute delete
473 Bytes
import fitz
class ExtractionError(Exception):
pass
def extract_structured(file_path, password=None):
doc = fitz.Document(file_path)
if doc.is_encrypted:
if password is None:
raise ExtractionError(
"PDF is password protected. Pass password= to extract()"
)
if not doc.authenticate(password):
raise ExtractionError("Incorrect password for PDF.")
# rest of the function implementation...