# EXTRACTTEXT

## Overview

The **EXTRACTTEXT** workflow application extracts text content from an input file (`.pdf`, `.docx`, `.txt`, `.xml`, `.htm`, `.html,` or `.md`) and returns the extracted text and its length. It supports optional parameters for maximum file size, trimming, and text normalization (Unix-style line breaks).&#x20;

## Parameters

### Required parameters

<table><thead><tr><th width="262.98583984375" valign="top">Parameter</th><th width="110.076904296875" valign="top">Type</th><th width="109.5726318359375" valign="top">Direction</th><th>Description</th></tr></thead><tbody><tr><td valign="top"><code>FILE</code></td><td valign="top">FILE</td><td valign="top">IN</td><td>The file from which to extract the text (must be <code>.pdf</code>, <code>.docx</code>,  <code>.txt</code>, <code>.xml, .htm</code>, <code>.html</code>, or <code>.md</code>)</td></tr><tr><td valign="top"><code>TEXT</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td>The extracted (and possibly normalized/trimmed) text</td></tr><tr><td valign="top"><code>LENGTH</code></td><td valign="top">NUMERIC</td><td valign="top">OUT</td><td>The length (number of characters) of the extracted text</td></tr></tbody></table>

### Optional parameters

<table><thead><tr><th width="263.923095703125" valign="top">Parameter</th><th width="113.62396240234375" valign="top">Type</th><th width="110.29913330078125" valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>MAX_FILE_SIZE</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Maximum allowed file size in MB</td></tr><tr><td valign="top"><code>TRIM_SIZE</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Maximum number of characters to keep from the extracted text</td></tr><tr><td valign="top"><code>NORMALIZE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>Whether to normalize line endings <br><strong>Possible values:</strong> </p><ul><li><code>Y</code></li><li><code>N</code></li><li><code>true</code></li><li><code>false</code></li></ul></td></tr></tbody></table>

## Supported file types

Documents must be provided in one of the following formats. The system validates file format before processing extraction.

<table><thead><tr><th width="151.455810546875" valign="top">Format</th><th width="149.9971923828125" valign="top">Extension</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top">PDF</td><td valign="top"><code>.pdf</code></td><td valign="top"><p>Portable Document Format</p><p></p><p>Text is extracted from all pages, including form fields.</p></td></tr><tr><td valign="top">Word</td><td valign="top"><code>.docx</code></td><td valign="top"><p>Microsoft Word documents (Office Open XML)</p><p></p><p>Text is extracted from paragraphs, tables, headers, footers, and text boxes.</p></td></tr><tr><td valign="top">Plain text</td><td valign="top"><code>.txt</code></td><td valign="top"><p>Plain text files</p><p></p><p>Content is returned as-is.</p></td></tr><tr><td valign="top">XML</td><td valign="top"><code>.xml</code></td><td valign="top"><p>XML documents</p><p></p><ul><li>All text content from XML nodes is extracted; element tags are stripped.</li><li>Processing is secured against XXE (XML External Entity) attacks.</li></ul></td></tr><tr><td valign="top">HTML</td><td valign="top"><code>.html</code>, <code>.htm</code></td><td valign="top"><p>HTML documents</p><p></p><ul><li>Readable text is extracted after removing <code>&#x3C;script></code>, <code>&#x3C;style></code>, and <code>&#x3C;noscript></code> elements.</li><li><code>&#x3C;br></code> tags are converted to line breaks.</li><li>HTML entities (e.g., <code>&#x26;amp;</code>, <code>&#x26;lt;</code>, <code>&#x26;#169;</code>) are decoded to their characters.</li><li>Whitespace is normalized.</li></ul></td></tr><tr><td valign="top">Markdown</td><td valign="top"><code>.md</code></td><td valign="top"><p>Markdown files</p><p></p><p>Content is returned as-is, preserving all markdown syntax (headings, links, formatting, etc.). Markdown is human-readable and well-suited for semantic search without syntax stripping.</p></td></tr></tbody></table>

## Error messages

<table><thead><tr><th valign="top">Error message</th><th valign="top">Cause</th></tr></thead><tbody><tr><td valign="top"><code>ExtractText: File must be a PDF, DOCX, TXT, XML, HTM, HTML or MD.</code></td><td valign="top">File extension is not one of the supported types</td></tr><tr><td valign="top">XML parsing error (e.g. <code>DtdProcessing is set to Prohibit</code>)</td><td valign="top">XML file contains a DTD declaration (blocked for security)</td></tr><tr><td valign="top">XML parsing error (e.g. <code>Data at the root level is invalid</code>)</td><td valign="top">XML file is malformed or not valid XML</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.workflowgen.com/admin/workflow-applications/extracttext.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
