# EXTRACTTEXT

## Aperçu

L’application de workflow **EXTRACTTEXT** extrait le contenu texte d’un fichier en entrée (`.pdf`, `.docx`, `.txt, .xml`, `.htm`, `.html` ou `md`) et retourne le texte extrait ainsi que sa longueur. Elle prend en charge des paramètres optionnels pour la taille maximale du fichier, le découpage et la normalisation du texte (sauts de ligne au format Unix).

## Paramètres requis

<table><thead><tr><th width="219.0997314453125" valign="top">Paramètre</th><th width="120.472900390625" valign="top">Type</th><th width="119.25640869140625" valign="top">Direction</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>FILE</code></td><td valign="top">FILE</td><td valign="top">IN</td><td valign="top">Le fichier à partir duquel extraire le texte (doit être au format <code>.pdf</code>, <code>.docx</code>, <code>.txt</code>, <code>.xml, .htm</code>, <code>.html</code> ou <code>.mx</code>)</td></tr><tr><td valign="top"><code>TEXT</code></td><td valign="top">TEXT</td><td valign="top">OUT</td><td valign="top">Le texte extrait (pouvant être normalisé ou découpé)</td></tr><tr><td valign="top"><code>LENGTH</code></td><td valign="top">NUMERIC</td><td valign="top">OUT</td><td valign="top">La longueur (nombre de caractères) du texte extrait</td></tr></tbody></table>

## Paramètres facultatifs

<table><thead><tr><th valign="top">Paramètre </th><th valign="top">Type</th><th 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">Taille maximale autorisée du fichier, en Mo</td></tr><tr><td valign="top"><code>TRIM_SIZE</code></td><td valign="top">NUMERIC</td><td valign="top">IN</td><td valign="top">Nombre maximal de caractères à conserver du texte extrait</td></tr><tr><td valign="top"><code>NORMALIZE</code></td><td valign="top">TEXT</td><td valign="top">IN</td><td valign="top"><p>Indique s’il faut normaliser les fins de ligne<br><strong>Valeurs possibles :</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>

## Types de fichiers supportés

Les documents doivent être fournis dans l’un des formats suivants. Le système valide le format du fichier avant de traiter l’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>Le texte est extrait de toutes les pages, y compris des champs de formulaire.</p></td></tr><tr><td valign="top">Word</td><td valign="top"><code>.docx</code></td><td valign="top"><p>Documents Microsoft Word (Office Open XML)</p><p></p><p>Le texte est extrait des paragraphes, des tableaux, des en-têtes, des pieds de page et des zones de texte.</p></td></tr><tr><td valign="top">Texte brut</td><td valign="top"><code>.txt</code></td><td valign="top"><p>Fichiers texte brut</p><p></p><p>Le contenu est retourné tel quel.</p></td></tr><tr><td valign="top">XML</td><td valign="top"><code>.xml</code></td><td valign="top"><p>Documents XML</p><p></p><ul><li>Tout le contenu texte des nœuds XML est extrait; les balises d’élément sont supprimées.</li><li>Le traitement est sécurisé contre les attaques XXE (XML External Entity).</li></ul></td></tr><tr><td valign="top">HTML</td><td valign="top"><code>.html</code>, <code>.htm</code></td><td valign="top"><p>Documents HTML</p><p></p><ul><li>Le texte lisible est extrait après suppression des éléments <code>&#x3C;script></code>, <code>&#x3C;style></code> et <code>&#x3C;noscript></code>.</li><li>Les balises <code>&#x3C;br></code> sont converties en sauts de ligne.</li><li>Les entités HTML (p. ex. <code>&#x26;amp;</code>, <code>&#x26;lt;</code>, <code>&#x26;#169;</code>) sont décodées en leurs caractères correspondants.</li><li>Les espaces blancs sont normalisés.</li></ul></td></tr><tr><td valign="top">Markdown</td><td valign="top"><code>.md</code></td><td valign="top"><p>Fichiers Markdown</p><p></p><p>Le contenu est retourné tel quel, en conservant toute la syntaxe Markdown (titres, liens, mise en forme, etc.). Markdown est lisible par l’humain et bien adapté à la recherche sémantique sans suppression de la syntaxe.</p></td></tr></tbody></table>

## Messages d’erreur

<table><thead><tr><th valign="top">Message d’erreur</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">L’extension du fichier ne correspond à aucun des types supportés</td></tr><tr><td valign="top">XML parsing error (e.g. <code>DtdProcessing is set to Prohibit</code>)</td><td valign="top">Le fichier XML contient une déclaration DTD (bloquée pour des raisons de sécurité)</td></tr><tr><td valign="top">XML parsing error (e.g. <code>Data at the root level is invalid</code>)</td><td valign="top">Le fichier XML est mal formé ou n’est pas un XML valide</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-fr/applications-de-workflow/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.
