> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IDocument

> IDocument object reference for ABBYY FlexiCapture scripts: access document fields, pages, rules, export results, properties, and processing state.

## What it does

Represents a document.

<a id="webverificationavailableinterface" />

<Note>
  Some methods and properties of this object are not available on the Web Verification Station for checking rules locally. The methods and properties that are not supported are marked with an asterisk (\*).
</Note>

## Methods

<table width="100%"><thead><tr><th style={{textAlign: 'left'}}><p><strong>Definition</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Description</strong></p></th></tr></thead><tbody><tr><td><p>AddFileToExportResults( sourceFile : string, destinationName : string, replaceIfExists : bool ) <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Adds a user file to document export results.</p><p>In the <strong>sourceFile </strong>parameter, specify the address of the user file to be added.</p><p><strong>Note: </strong> Be sure to specify the root export path in the project settings. Otherwise, the user file will be placed into the batch folder in the file storage location.</p><p>In the <strong>destinationName </strong>parameter, specify an export destination.</p><p>Set the <strong>replaceIfExists</strong> parameter to <em>true</em> if you want to overwrite any existing file with the same name in the destination. Set the <strong>replaceIfExists</strong> parameter to <em>false</em> if you want to keep any existing file with the same name in the destination and add an error message to the log.</p></td></tr><tr><td><p>CheckRules( ) <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Checks all rules in the document. Write permissions for the document are required.</p></td></tr><tr><td><p>Field( name : string ) : <a href="/flexi-capture/appendix/scripts/ifield">IField</a> <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Gets access to a document field by the full path to the field. <a href="/flexi-capture/appendix/scripts/scripting-model#pathforming">Full paths</a> are used.</p><p>Is an internal<a href="#loadintomemoryrequired">\*\*</a> field. Cannot be used in rules.</p></td></tr><tr><td><p>HasField( name : string ) : bool <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Checks whether a field with the specified path exists. <a href="/flexi-capture/appendix/scripts/scripting-model#pathforming">Relative paths</a> are used.</p><p>Is an internal<a href="#loadintomemoryrequired">\*\*</a> field. Cannot be used in rules.</p></td></tr><tr><td><p>IndexedItemValue( name : string ) : VARIANT <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Retrieves the field value by the name or the path to the field. Available from external fields of documents and pages. Both a field name and a <a href="/flexi-capture/appendix/scripts/scripting-model#pathforming">full path</a> to the field can be used. Cannot be used in rules.</p></td></tr><tr><td><p>IndexedItemValues( name : string ) : <a href="/flexi-capture/appendix/scripts/ivariant">IVARIANTArray</a> <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Retrieves a set of index values corresponding to a field in the Document Definition by the name or the path to the field. If a field is marked as an index field in the recurring section, the method returns all values of the field from all sections. Available from external fields of documents and pages. Both a field name and a <a href="/flexi-capture/appendix/scripts/scripting-model#pathforming">full path</a> to the field can be used. Cannot be used in rules.</p></td></tr><tr><td><p>Property( name : string ) : VARIANT</p></td><td><p>Retrieves the value of a specified property by its name. The returned value can be in the form of a string, a number or time.</p><p>Properties names and returned values:</p><ul><li>Exported - when the document was exported</li><li>ExportedBy - who exported the document</li><li>Created - when the document was created</li><li>CreatedBy - who created the document</li><li>Recognized - when the document was recognized</li><li>RecognizedBy - who recognized the document</li><li>Modified - when the document was modified last</li><li>ModifiedBy - who modified the document</li><li>TotalSymbolsCount - the total number of symbols</li><li>UncertainSymbolsCount - the total number of uncertain symbols</li><li>RecognizedSymbolsCount - the number of recognized symbols</li><li>Comment - the comment on the document</li><li>ProcessingErrors - document processing errors</li><li>ProcessingWarnings - document processing warnings</li></ul><ul><li>Verified - the time when the fields of the documents were last edited manually</li><li>VerifiedBy - the user who made the last manual changes to the fields of the document (does not save information from Processing Stations)</li></ul></td></tr><tr><td><p>SaveAs( filename : string, \[optional] options : <a href="/flexi-capture/appendix/scripts/iexportimagesavingoptions">IExportImageSavingOptions</a> ) <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Saves the image of a one-page or multi-page document. If no saving format is specified in the saving options, the image is saved in a \*.tif file. This is an internal<a href="#loadintomemoryrequired">\*\*</a> field.</p></td></tr><tr><td><p>SaveAsStream( \[optional] options: <a href="/flexi-capture/appendix/scripts/iexportimagesavingoptions">IExportImageSavingOptions</a>) : byte\[] <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Saves the document to a memory stream and returns it as a byte array (COM SafeArray).</p><p><strong>Note: </strong> JScript and VBScript do not support iteration over this array.</p></td></tr><tr><td><p>SaveXmlToFile( filename : string ) <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Saves the XML file with the description of the document without preprocessing to the specified location to be used in the Web Verification Station.</p></td></tr><tr><td><p>SaveXmlToFileStorage() <a href="#webverificationavailableinterface">\*</a></p></td><td><p>Saves the XML file with the description of the document without preprocessing to the file storage to be used in the Web Verification Station.</p></td></tr></tbody></table>

<Note>
  The **Property** method should not be confused with the **Properties** collection which contains document properties specified by the user.
</Note>

## Properties

<table width="100%"><thead><tr><th style={{textAlign: 'left'}}><p><strong>Name</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Type</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Access</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Description</strong></p></th></tr></thead><tbody><tr><td><p>Action <a href="#webverificationavailableinterface">\*</a></p></td><td><p><a href="/flexi-capture/appendix/scripts/iactionresult">IActionResult</a></p></td><td><p>Read-only</p></td><td><p>Is effective in export and post export scripts only.</p></td></tr><tr><td><p>AsBatchItem <a href="#webverificationavailableinterface">\*</a></p></td><td><p><a href="/flexi-capture/appendix/scripts/i-batch-item">IBatchItem</a></p></td><td><p>Read-only</p></td><td><p>Converts the document into an <a href="/flexi-capture/appendix/scripts/i-batch-item">IBatchItem</a> object.</p></td></tr><tr><td><p>AssemblingErrors</p></td><td><p><a href="/flexi-capture/appendix/scripts/iassemblingerrors">IAssemblingErrors</a></p></td><td><p>Read-only</p></td><td><p>A collection of assembly errors. Access to the collection is always read-only.</p></td></tr><tr><td><p>Attachments</p></td><td><p><a href="/flexi-capture/appendix/scripts/iattachments">IUserAttachments</a></p></td><td><p>Read-only</p></td><td><p>User attachments</p></td></tr><tr><td><p>Batch</p></td><td><p><a href="/flexi-capture/appendix/scripts/ibatch">IBatch</a></p></td><td><p>Read-only</p></td><td><p>The batch. Irrespective of permissions of the script for the document, access to the batch is read-only and internal<a href="#loadintomemoryrequired">\*\*</a> fields of documents and pages are unavailable.</p></td></tr><tr><td><p>BatchName</p></td><td><p>string</p></td><td><p>Read-only</p></td><td><p>The batch name.</p></td></tr><tr><td><p>Children <a href="#webverificationavailableinterface">\*</a></p></td><td><p><a href="/flexi-capture/appendix/scripts/ifields">IFields</a></p></td><td><p>Read-only</p></td><td><p>Child fields (document sections). Unlike the property <strong>Sections</strong>, section order corresponds to their order in Document Definition. Recurring sections are represented as one item and the instances are available through the <strong>Items</strong> method of that item.</p><p>Is an internal<a href="#loadintomemoryrequired">\*\*</a> field. Cannot be used in rules.</p></td></tr><tr><td><p>Comment</p></td><td><p>string</p></td><td><p>Read/write</p></td><td><p>A comment of the document.</p></td></tr><tr><td><p>DefinitionName</p></td><td><p>string</p></td><td><p>Read-only</p></td><td><p>The name of the Document Definition.</p><p>For unprocessed and unrecognized documents, the property returns an empty string.</p></td></tr><tr><td><p>DocumentDefinition</p></td><td><p><a href="/flexi-capture/appendix/scripts/idocinfo">IDocumentDefinitionInfo</a></p></td><td><p>Read-only</p></td><td><p>Detailed information about the Document Definition which is matched on the document.</p></td></tr><tr><td><p>HasErrors</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document has single-field or multi-field errors.</p></td></tr><tr><td><p>HasUnpreparedImages</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document contains un-preprocessed pages.</p></td></tr><tr><td><p>HasWarnings</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document has rule or format warnings.</p></td></tr><tr><td><p>Id</p></td><td><p>string</p></td><td><p>Read-only</p></td><td><p>Document identifier (External Id). The value starts with 1 and is unique only within one batch.</p></td></tr><tr><td><p>Index</p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>The index of the document in the batch. The value starts with 0 and is unique only within one task.</p></td></tr><tr><td><p>IsAnalyzed</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document is analyzed. The document is considered analyzed if all pages of the document are analyzed.</p></td></tr><tr><td><p>IsAssembled</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document is assembled.</p></td></tr><tr><td><p>IsExcludedFromAutomaticAssembling</p></td><td><p>bool</p></td><td><p>Read/write</p></td><td><p>Checks if the document is included into automatic assembly.</p></td></tr><tr><td><p>IsExported</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document is exported.</p></td></tr><tr><td><p>IsRecognized</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document is recognized. The document is considered recognized if each page of the document is either recognized or this is an annex page.</p></td></tr><tr><td><p>IsUsedForTraining</p></td><td><p>bool</p></td><td><p>Read/write</p></td><td><p>Specifies whether the document is used for training.</p></td></tr><tr><td><p>IsVerified</p></td><td><p>bool</p></td><td><p>Read-only</p></td><td><p>Specifies whether the document is verified.</p></td></tr><tr><td><p>Pages</p></td><td><p><a href="/flexi-capture/appendix/scripts/ipages">IPages</a></p></td><td><p>Read-only</p></td><td><p>Document pages.</p></td></tr><tr><td><p>PreviousStageInfo <a href="#webverificationavailableinterface">\*</a></p></td><td><p><a href="/flexi-capture/appendix/scripts/istageinfo">IStageInfo</a></p></td><td><p>Read-only</p></td><td><p>Returns the <a href="/flexi-capture/appendix/scripts/istageinfo">IStageInfo</a> object, i.e. the processing stage of the document. The <strong>TaskId</strong> and <strong>PrincipalId</strong> fields are not used.</p></td></tr><tr><td><p>Priority</p></td><td><p><a href="/flexi-capture/appendix/scripts/tprocessingpriority-appendix-scripts">TProcessingPriority</a></p></td><td><p>Read-only</p></td><td><p>A priority of the document.</p></td></tr><tr><td><p>ProcessingErrors <a href="#webverificationavailableinterface">\*</a></p></td><td><p>string</p></td><td><p>Read-only</p></td><td><p>Processing errors divided by line breaks.</p></td></tr><tr><td><p>ProcessingWarnings <a href="#webverificationavailableinterface">\*</a></p></td><td><p>string</p></td><td><p>Read-only</p></td><td><p>Processing warnings divided by line breaks.</p></td></tr><tr><td><p>ProhibitedUserId <a href="#webverificationavailableinterface">\*</a></p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>A task created from the document will not be available to the user with the given identifier. By default the value is "0" which means that the task is available to all users.</p></td></tr><tr><td><p>Properties</p></td><td><p><a href="/flexi-capture/appendix/scripts/iproperties">IProperties</a></p></td><td><p>Read-only</p></td><td><p>Registration parameters of the document.</p></td></tr><tr><td><p>RecognizedSymbolsCount <a href="#webverificationavailableinterface">\*</a></p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>The number of recognized symbols.</p></td></tr><tr><td><p>RuleErrors <a href="#webverificationavailableinterface">\*</a></p></td><td><p><a href="/flexi-capture/appendix/scripts/iruleerrors">IRuleErrors</a></p></td><td><p>Read-only</p></td><td><p>A collection of document errors (format errors, rule errors, errors of merging double verification results).</p><p><strong>Note: </strong> Available for open documents only.</p></td></tr><tr><td><p>Sections <a href="#webverificationavailableinterface">\*</a></p></td><td><p><a href="/flexi-capture/appendix/scripts/ifields">IFields</a></p></td><td><p>Read-only</p></td><td><p>A flat list of document sections. If there is a recurring section, the list contains all replications of the section. Sections in the list go in the same order as the first pages of the document sections. Sections without pages close the list.</p><p>Is an internal<a href="#loadintomemoryrequired">\*\*</a> field. Cannot be used in rules.</p></td></tr><tr><td><p>StageInfo</p></td><td><p><a href="/flexi-capture/appendix/scripts/istageinfo">IStageInfo</a></p></td><td><p>Read-only</p></td><td><p>Information about the processing stage on the application server.</p></td></tr><tr><td><p>SymbolsForVerificationCount</p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>The number of symbols that need verification.</p></td></tr><tr><td><p>TotalSymbolsCount</p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>The total number of symbols.</p></td></tr><tr><td><p>UncertainSymbolsCount</p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>The number of uncertain symbols.</p></td></tr></tbody></table>

<a id="loadintomemoryrequired" />\*\* - The internal field requires loading the object into memory.
