# Get File Content

This is pre-built Action located under the **@Generic Element,** instructs the Avo Assure to get the content from the .txt or .pdf formatted file and save the result in dynamic variable.

### **Syntax**

**Input value:**

**For Text:** `<file path>;<line number>(optional)`&#x20;

| Argument                             | Description                                                                         |
| ------------------------------------ | ----------------------------------------------------------------------------------- |
| <p>\<file path></p><p>(Required)</p> | Provide file path from where the content needs to be extracted.                     |
| <p>\<line number><br>(Optional)</p>  | Specify the line number from which the content needs to be extracted from the file. |

**For PDF:** `<PDF_Filepath>;<pageNumber>;<start string(optional)>;<EndString(optional)>;<image/all/text(optional)>`&#x20;

| Argument                                 | Description                                                                                                                                              |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<PDF\_Filepath></p><p>(Required)</p> | Provide the file path of the PDF from which the content needs to be extracted.                                                                           |
| <p>\<pageNumber><br>(Required)</p>       | Specify the page number from which content should be extracted from the PDF file                                                                         |
| <p>\<start string><br>(Optional)</p>     | Specify the text marker that indicates where the content extraction should begin.                                                                        |
| <p>\<EndString><br>(Optional)</p>        | Specify the text marker that indicates where the content extraction should stop.                                                                         |
| <p>\<image/all/text><br>(optional)</p>   | <p>Defines the type of content to extract:<br>• text → extracts only text<br>• image → extracts only images<br>• all → extracts both text and images</p> |

**Output value:**&#x20;

| Argument                                 | Description                                              |
| ---------------------------------------- | -------------------------------------------------------- |
| <p>\<Dynamic Variable><br>(Required)</p> | This variable stores the extracted content from the file |
| <p>\<Dynamic Variable><br>(Optional)</p> | This variable stores the status as **true** or **false** |

**Example 1**

**Retrieve specific or full content from a file** \
\
The **Get File Content** action retrieves content from the specified file path provided in the Input Value column (e.g., **C:\sam\sample.txt;1**). If a line number is specified, only that specific line is retrieved; otherwise, the entire file content will retrieve. The retrieved content is stored in the **{File Content}** variable, and the action status is saved in the **{Status}** variable with the following possible values:

* **True** – if the content is retrieved successfully
* **False** – if the content is not retrieved

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FKNbsaN2xWrUrckGPjmJi%2Fimage.png?alt=media&#x26;token=d03dca74-30d6-4c33-89ef-09c429e6155a" alt=""><figcaption></figcaption></figure>

**Example 2**

**Extract content from a PDF file**\
\
The **Get File Content** action retrieves the content from a PDF file (e.g., **C:\Docs\sample.pdf;2;Invoice Start;Invoice End;text**) based on the file path, page number, and optional start and end strings provided in the Input Value column. It allows extraction of specific content (text, image, or all) from a defined section of a specific page. The retrieved content is stored in the **{PDF Content}** variable, and the action status is saved in the **{Status}** variable with the following possible values:

* **True** – if the content is retrieved successfully
* **False** – if the content is not retrieved

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2F0FuE5KbNZMbA9SnoMFC2%2Fimage.png?alt=media&#x26;token=1b2bedd1-4f10-4c2a-8045-56473f8ea4cf" alt=""><figcaption></figcaption></figure>
