> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PDF Reader

> Convert local or remote PDF files into documents with PDFReader.

Pass `PDFReader` to `Knowledge.insert()` to configure PDF parsing and chunking.

```python pdf_reader.py theme={null}
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reader.pdf_reader import PDFReader
from agno.models.openai import OpenAIResponses
from agno.vectordb.pgvector import PgVector

db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"

knowledge = Knowledge(
    vector_db=PgVector(
        table_name="pdf_documents",
        db_url=db_url,
    ),
)

agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    knowledge=knowledge,
    search_knowledge=True,
)

if __name__ == "__main__":
    knowledge.insert(
        name="Thai Recipes",
        url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf",
        reader=PDFReader(split_on_pages=True),
    )
    agent.print_response(
        "How do I make chicken and galangal in coconut milk soup?",
        markdown=True,
    )
```

## Run the Agent

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai pgvector psycopg pypdf sqlalchemy
```

**2. Export the API key**

```bash theme={null}
export OPENAI_API_KEY=your_openai_api_key_here
```

<Snippet file="run-pgvector-step.mdx" />

**3. Run the agent**

```bash theme={null}
python pdf_reader.py
```

## Reader Parameters

<Snippet file="pdf-reader-reference.mdx" />

Use `PDFReader.async_read()` or `Knowledge.ainsert()` in an asynchronous ingestion path.

## Next Steps

| Task | Guide |
| - | - |
| Choose a chunking strategy | [Chunking](https://agno-v2.mintlify.site/knowledge/concepts/chunking/overview.md) |
| Process images with OCR | [Readers Overview](https://agno-v2.mintlify.site/knowledge/concepts/readers/overview.md) |
| Configure another reader | [Docling Reader](https://agno-v2.mintlify.site/knowledge/concepts/readers/docling-reader.md) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.