From 701fd11e9c381816e6c3acfd448ed7b25122d625 Mon Sep 17 00:00:00 2001 From: Mathieu Bartels <32941185+MathieuBartels@users.noreply.github.com> Date: Thu, 13 Mar 2025 12:29:59 +0100 Subject: [PATCH] Allow PdfReader type as file argument to DocumentParser.parse --- src/openparse/doc_parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openparse/doc_parser.py b/src/openparse/doc_parser.py index 5caf975..ac8e3bf 100644 --- a/src/openparse/doc_parser.py +++ b/src/openparse/doc_parser.py @@ -1,5 +1,6 @@ from pathlib import Path from typing import List, Literal, TypedDict, TypeVar, Union +from pypdf import PdfReader from openparse import consts, tables, text from openparse._types import NOT_GIVEN, NotGiven @@ -82,7 +83,7 @@ def __init__( def parse( self, - file: Union[str, Path], + file: Union[str, Path, PdfReader], ocr: bool = False, ) -> ParsedDocument: """