> ## Documentation Index
> Fetch the complete documentation index at: https://ai-kb.automationanywhere.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PDF Toolkit

> Extract text from PDFs, convert pages to images, and generate PDFs from text or images

The **PDF** toolkit gives agents PDF-specific tools: extract text, turn a page into an image, and generate PDFs from plain text or from an image. No connection or API key is required.

Add it on the agent **Toolkits** tab, then reference the tools with `@` in the personality prompt when the agent should work with PDFs.

## Prerequisites

* An agent you can edit
* For extraction or page conversion: a PDF from a chat upload, a Knowledge Base file, a public HTTPS URL, or a base64 PDF data URL
* For image-to-PDF: an image as a base64 data URL or HTTPS URL (JPEG, PNG, GIF, or WebP)

## Available tools

| Tool                 | Description                                                                                           |
| -------------------- | ----------------------------------------------------------------------------------------------------- |
| **Extract Text**     | Extracts text from every page of a PDF and returns the combined text with page and character counts.  |
| **Convert to Image** | Converts one PDF page to a PNG image. Set the page number (1-based) and optional DPI (default `200`). |
| **Text to PDF**      | Builds a PDF from plain text with wrapping and pagination. Optional filename (default `output.pdf`).  |
| **Image to PDF**     | Embeds an image into a single-page PDF sized to the image. Optional filename (default `output.pdf`).  |

### How PDF inputs are resolved

For **Extract Text** and **Convert to Image**, the agent can pass:

* A chat attachment filename from the current conversation
* A Knowledge Base file name or path in the current project
* An `https://` URL to a PDF
* A base64 data URL (`data:application/pdf;base64,…`)

If several chat or KB files share the same name, ask for the exact filename or full KB path.

**Image to PDF** accepts base64 or HTTPS image URLs only (not chat/KB filename resolution).

## Use cases

* Pull clauses or tables of contents out of uploaded policy PDFs during a conversation
* Convert a cover page or diagram page to an image for review or further analysis
* Generate a short PDF summary or receipt from text the agent produced
* Wrap a generated chart or screenshot into a one-page PDF for download

## Tips

* Prefer **Extract Text** for searchable/text PDFs. Scanned image-only PDFs may return little or no text — use Knowledge Base ingest or OCR elsewhere for those.
* **Convert to Image** handles one page per call. Repeat with the next page number for multi-page output.
* Generated PDFs and images are returned as data for the conversation — they are not automatically saved as Knowledge Base documents. Use [Document Manager](/agents/toolkits/document-manager) or File Helpers when you need a stored file workflow.
* For general file read/save (DOCX, XLSX, CSV, re-encoding), use [File Helpers](/agents/toolkits/file-helpers) instead.

## Troubleshooting

| Symptom                        | What to check                                                                             |
| ------------------------------ | ----------------------------------------------------------------------------------------- |
| Empty or sparse extracted text | The PDF may be scanned/image-only; try a text-based PDF or KB ingest with OCR             |
| Ambiguous file name            | Multiple chat or KB matches — use the exact name or full path                             |
| Convert to Image fails         | Confirm page number is within the PDF; try a lower DPI if the page is very large          |
| Image to PDF rejects the file  | Use a base64 data URL or HTTPS image URL (not a chat/KB filename alone)                   |
| Confused with Document Manager | Document Manager creates/edits in-chat markdown documents; PDF toolkit works on PDF files |

## Related

* [File Helpers](/agents/toolkits/file-helpers)
* [Document Manager](/agents/toolkits/document-manager)
* [Knowledge Base toolkit](/agents/toolkits/knowledge-base)
* [Toolkits overview](/agents/toolkits/overview)
