langchain.document_loaders.pdf
.PyPDFLoader¶
- class langchain.document_loaders.pdf.PyPDFLoader(file_path: str, password: Optional[Union[str, bytes]] = None, headers: Optional[Dict] = None, extract_images: bool = False)[source]¶
Load PDF using pypdf into list of documents.
Loader chunks by page and stores page numbers in metadata.
Initialize with a file path.
Attributes
source
Methods
__init__
(file_path[, password, headers, ...])Initialize with a file path.
Lazy load given path as pages.
load
()Load given path as pages.
load_and_split
([text_splitter])Load Documents and split into chunks.
- __init__(file_path: str, password: Optional[Union[str, bytes]] = None, headers: Optional[Dict] = None, extract_images: bool = False) None [source]¶
Initialize with a file path.
- load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document] ¶
Load Documents and split into chunks. Chunks are returned as Documents.
- Parameters
text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.
- Returns
List of Documents.