Skip to content

ExtractText

Extracts the text content of a file.

1
myDocumentFiles.ExtractText(id: string, format?: ( "plaintext" | "markdown" )):string

Parameters

string id
    The ID of the file.

( "plaintext" | "markdown" ) format optional
    Output format: "plaintext" (default) or "markdown". Case-insensitive.

Returns

The extracted plain text, or Markdown when requested.

Remarks

Documents are extracted as Markdown first and converted to plain text by default. When extraction is not possible, it returns an empty string.

Examples

Extract the text of an uploaded document

1
2
3
4
var fileId = $Xml.Evaluate('Contract');

$Xml.SetValue('ContractText', $Files.ExtractText(fileId));
$Xml.SetValue('ContractMarkdown', $Files.ExtractText(fileId, 'markdown'));