> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/datasources/pdf.md).

# PDF

Actions for handling PDF documents

## Module: [implementation](/framework-structure.md#implementation).datasources.pdf

***

***

## <mark style="color:green;">PDFRead</mark>

Read PDF document. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], Dict\[int, Page]]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):**\
  Expected keys:&#x20;
  * <mark style="color:red;">**"path\_to\_file"**</mark>**&#x20;(str):** Path to PDF file;
  * <mark style="color:red;">**"pages"**</mark>**&#x20;(List\[int], optional):** Pages to read. If not provided, read complete document;

#### Returns:

* **Dict\[int, Page]:** PDF document pages;

***

***

***

## <mark style="color:green;">PDFExtractTexts</mark>

Extract texts from pages. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[int, Page], Dict\[int, str]]**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**tables**</mark>**&#x20;(bool, optional):** If equals to True, include text from tables. Defaults to True.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[int, Page]):** PDF document pages.

#### Returns:

* **Dict\[int, str]:** Extracted texts.

***

***

***

## <mark style="color:green;">PDFFindTables</mark>

Find tables on pages. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[int, Page], Dict\[int, List\[Table]]]]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[int, Page]):** PDF document pages.

#### Returns:

* **Dict\[int, List\[Table]]:** Founded tables.

***

***

***

## <mark style="color:green;">PDFExtractTables</mark>

Extract tables from pages. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[int, Page], Dict\[int, List\[Table]]]]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[int, Page]):** PDF document pages.

#### Returns:

* **Dict\[int, Any]:** Extracted tables.

***

***

***

## <mark style="color:green;">PDFExtractImages</mark>

Extract images from pages. Subclass of [**Action**](/core/action.md)**.** Type of \
[**Action**](/core/action.md)**\[Dict\[int, Page], Dict\[int, List\[**[**Image.Image**](https://pillow.readthedocs.io/en/stable/reference/Image.html#the-image-class)**]]]]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[int, Page]):** PDF document pages.

#### Returns:

* **Dict\[int, List\[**[**Image.Image**](https://pillow.readthedocs.io/en/stable/reference/Image.html#the-image-class)**]]:** Extracted images.

***

***

***

## <mark style="color:green;">PDFWrite</mark>

Write PDF file. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], None]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** Data to process. \
  Expected keys:&#x20;
  * <mark style="color:red;">**"path\_to\_file"**</mark>**&#x20;(str):** Path to audio file;
  * <mark style="color:red;">**"page\_width"**</mark>**&#x20;(float, optional):** Page width in cm;
  * <mark style="color:red;">**"page\_height"**</mark>**&#x20;(float, optional):** Page height in cm;
  * <mark style="color:red;">**"x\_padding"**</mark>**&#x20;(float, optional):** x padding in cm;
  * <mark style="color:red;">**"y\_padding"**</mark>**&#x20;(float, optional):** y padding in cm;
  * <mark style="color:red;">**"text"**</mark>**&#x20;(str):** text to write;

***

***
