# PyPDFDirectoryLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/pdf/PyPDFDirectoryLoader)

Load and parse a directory of PDF files using 'pypdf' library.

This class provides methods to load and parse multiple PDF documents in a directory,
supporting options for recursive search, handling password-protected files,
extracting images, and defining extraction modes. It integrates the `pypdf` library
for PDF processing and offers synchronous document loading.

## Signature

```python
PyPDFDirectoryLoader(
    self,
    path: Union[str, PurePath],
    glob: str = '**/[!.]*.pdf',
    silent_errors: bool = False,
    load_hidden: bool = False,
    recursive: bool = False,
    extract_images: bool = False,
    *,
    password: Optional[str] = None,
    mode: Literal['single', 'page'] = 'page',
    images_parser: Optional[BaseImageBlobParser] = None,
    headers: Optional[dict] = None,
    extraction_mode: Literal['plain', 'layout'] = 'plain',
    extraction_kwargs: Optional[dict] = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `Union[str, PurePath]` | Yes | The path to the directory containing PDF files to be loaded. |
| `glob` | `str` | No | The glob pattern to match files in the directory. (default: `'**/[!.]*.pdf'`) |
| `silent_errors` | `bool` | No | Whether to log errors instead of raising them. (default: `False`) |
| `load_hidden` | `bool` | No | Whether to include hidden files in the search. (default: `False`) |
| `recursive` | `bool` | No | Whether to search subdirectories recursively. (default: `False`) |
| `extract_images` | `bool` | No | Whether to extract images from PDFs. (default: `False`) |
| `password` | `Optional[str]` | No | Optional password for opening encrypted PDFs. (default: `None`) |
| `mode` | `Literal['single', 'page']` | No | The extraction mode, either "single" for extracting the entire document or "page" for page-wise extraction. (default: `'page'`) |
| `images_parser` | `Optional[BaseImageBlobParser]` | No | Optional image blob parser.. (default: `None`) |
| `headers` | `Optional[dict]` | No | Optional headers to use for GET request to download a file from a web path. (default: `None`) |
| `extraction_mode` | `Literal['plain', 'layout']` | No | “plain” for legacy functionality, “layout” for experimental layout mode functionality (default: `'plain'`) |
| `extraction_kwargs` | `Optional[dict]` | No | Optional additional parameters for the extraction process. (default: `None`) |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    path: Union[str, PurePath],
    glob: str = '**/[!.]*.pdf',
    silent_errors: bool = False,
    load_hidden: bool = False,
    recursive: bool = False,
    extract_images: bool = False,
    *,
    password: Optional[str] = None,
    mode: Literal['single', 'page'] = 'page',
    images_parser: Optional[BaseImageBlobParser] = None,
    headers: Optional[dict] = None,
    extraction_mode: Literal['plain', 'layout'] = 'plain',
    extraction_kwargs: Optional[dict] = None,
)
```

| Name | Type |
|------|------|
| `path` | `Union[str, PurePath]` |
| `glob` | `str` |
| `silent_errors` | `bool` |
| `load_hidden` | `bool` |
| `recursive` | `bool` |
| `extract_images` | `bool` |
| `password` | `Optional[str]` |
| `mode` | `Literal['single', 'page']` |
| `images_parser` | `Optional[BaseImageBlobParser]` |
| `headers` | `Optional[dict]` |
| `extraction_mode` | `Literal['plain', 'layout']` |
| `extraction_kwargs` | `Optional[dict]` |


## Properties

- `password`
- `mode`
- `path`
- `glob`
- `load_hidden`
- `recursive`
- `silent_errors`
- `extract_images`
- `images_parser`
- `headers`
- `extraction_mode`
- `extraction_kwargs`

## Methods

- [`load()`](https://reference.langchain.com/python/langchain-community/document_loaders/pdf/PyPDFDirectoryLoader/load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_loaders/pdf.py#L422)