> ## 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.

# FRDocument Object (IFRDocument Interface)

This object corresponds to a processing document that may contain several pages. The FRDocument object is a root for a collection of document pages. Each page contains an open image and image layout.

The FRDocument object provides all necessary methods for document processing. You may process a document using only one method ([Process](/fine-reader/engine/api-reference/document-related-objects/frdocument/process-method) method), or process it step by step performing analysis, recognition, synthesis, and export. Usually, all these steps are obligatory for general scenarios of document processing. See details in the descriptions of corresponding methods. After you have finished your work with the FRDocument object, release all the resources that were used by this object (use the [Close](/fine-reader/engine/api-reference/document-related-objects/frdocument/close-method) method).

The object provides access to the different document attributes such as its author, keywords, subject, and title, via the DocumentContentInfo property.

The FRDocument object is a so-called "[connectable object](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-connectable-objects)." For Visual Basic in FRE for Windows, it may be declared WithEvents. For C++ (all supported operating systems), this means that it supports the IConnectionPointContainer interface. To receive notification events during processing, a C++ user should create an object derived from the [IFRDocumentEvents](/fine-reader/engine/api-reference/document-related-objects/ifrdocumentevents) interface, then:

* In Linux or macOS, advise the object to the FRDocument object by a call to the AdviseFREngineObject global function.
* In Windows, set up the connection between the object and the events source implemented in the FRDocument object by standard COM means.

In Windows: The FRDocument object may also be declared WithEvents in Visual Basic. The methods of the FRDocument object report information about page processing progress through special outgoing interfaces. These interfaces are IFRDocumentEvents (for C++) and the dispinterface DIFRDocumentEvents (for Visual Basic). It should be noted that Visual Basic users should not care for details of implementing event interfaces, as this development platform provides easy means for handling them.

## Properties

<table><thead><tr><th><p><strong>Name</strong></p></th><th><p><strong>Type</strong></p></th><th><p><strong>Description</strong></p></th></tr></thead><tbody><tr><td><p><strong>Application</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/engine-object-iengine-interface">Engine</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Returns the <strong>Engine</strong> object.</p></td></tr><tr><td colspan="3"><p><em>Common attributes</em></p></td></tr><tr><td><p><a name="allocatedsize" /><strong>AllocatedSize</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">\_\_int64</a></strong>, read-only</p></td><td><p>Returns the size of the memory allocated for the <strong>IFRDocument</strong> object. The value of this property is measured in bytes.</p></td></tr><tr><td><p><a name="pages" /><strong>Pages</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/document-related-objects/frpages">FRPages</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Returns the collection of pages of the document.</p></td></tr><tr><td><p><a name="plaintext" /><strong>PlainText</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/text-related-objects/plaintext">PlainText</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Returns the text of the document in a special "plain text" format.</p></td></tr><tr><td colspan="3"><p><em>Document languages</em></p></td></tr><tr><td><p><a name="basiclanguage" /><strong>BasicLanguage</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">BSTR</a></strong>, read-only</p></td><td><p>Returns the main language of the recognized document. The property contains the internal name of the first language in the collection of detected languages (<strong>DetectedLanguages</strong> property).</p><p>This property has a meaningful value only if recognition was performed with the automatic language detection on (see the <strong><a href="/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/recognizerparams#languagedetectionmode">IRecognizerParams::LanguageDetectionMode</a></strong> property for details); otherwise, it is an empty string.</p></td></tr><tr><td><p><a name="detectedlanguages" /><strong>DetectedLanguages</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/language-related-objects/detectedlanguages">DetectedLanguages</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Provides access to the collection of recognition languages detected in the recognized document. Languages in the collection are sorted by the frequency of occurrence: from the most frequently occurred to the least.</p><p>This property has a meaningful value only if recognition was performed with the automatic language detection on (see the <strong><a href="/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/recognizerparams#languagedetectionmode">IRecognizerParams::LanguageDetectionMode</a></strong> property for details).</p><p>The list of languages is updated only after recognition, i.e., if you edit the layout of the document manually, the collection remains the same.</p></td></tr><tr><td colspan="3"><p><em>Document structure</em></p></td></tr><tr><td><p><a name="documentstructureoutofdate" /><strong>DocumentStructureOutOfDate</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">VARIANT\_BOOL</a></strong>, read-only</p></td><td><p>Specifies whether the logical structure of the document is out of date. If this property is TRUE, you should perform document synthesis before export. Otherwise, an error will occur during export.</p><p>For Visual Components, this property is useful when you work with Visual Components. The logical structure of a document becomes invalid if a user changes the order or the number of pages in the document via GUI of Visual Components. If export of such document is performed using commands available in Visual Components, Visual Components synthesize the document automatically. But if you use FineReader Engine API methods for export, you are responsible for performing document synthesis before export.</p><Note>It is worth noting that not only document structure, but also page structure can become invalid. Therefore before export you should also check that all pages in the document have valid page structure (see the <a href="/fine-reader/engine/api-reference/document-related-objects/frpage#pagestructureoutofdate">IFRPage::PageStructureOutOfDate</a> property).</Note></td></tr><tr><td colspan="3"><p><em>Business cards</em></p></td></tr><tr><td><p><a name="businesscards" /><strong>BusinessCards</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/document-related-objects/businesscards">BusinessCards</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Provides access to the collection of business cards detected in the document.</p></td></tr><tr><td colspan="3"><p><em>Attachments and metadata</em></p></td></tr><tr><td><p><a name="documentcontentinfo" /><strong>DocumentContentInfo</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/document-related-objects/documentcontentinfo">DocumentContentInfo</a></strong></p></td><td><p>Contains information about the author, keywords, subject, and title of the document and stores the document information dictionary.</p></td></tr><tr><td><p><a name="pdfattachments" /><strong>PDFAttachments</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/document-related-objects/pdfattachments">PDFAttachments</a></strong></p></td><td><p>Returns the collection of attachments of the document. They are extracted from the input PDF document during opening, or you can add your own files to be attached to the output PDF file during export. To attach all the files of this collection to the output PDF file, set the <strong><a href="/fine-reader/engine/api-reference/parameter-objects/export-parameters/pdfexportfeatures">IPDFExportFeatures::WriteSourceAttachments</a></strong> property to TRUE.</p></td></tr><tr><td><p><a name="pdffontnames" /><strong>PDFFontNames</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/supplementary-objects-and-methods/stringscollection">StringsCollection</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Returns the collection of the names of fonts which have been extracted out of the input PDF file resources. If the document has been created by opening a file in other format, or from a PDF file containing no fonts, an empty collection will be returned.</p></td></tr><tr><td><p><a name="sourcehasdigitalsignature" /><strong>SourceHasDigitalSignature</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">VARIANT\_BOOL</a></strong>, read-only</p></td><td><p>Indicates whether at least one of the source files was a digitally signed PDF.</p></td></tr><tr><td colspan="3"><p><em>Temporary files and flushing policy</em></p></td></tr><tr><td><p><a name="pageflushingpolicy" /><strong>PageFlushingPolicy</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/enumerations/pageflushingpolicyenum">PageFlushingPolicyEnum</a></strong></p></td><td><p>Specifies if the <strong><a href="/fine-reader/engine/api-reference/image-related-objects/imagedocument">ImageDocument</a></strong> and the <strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layout">Layout</a></strong> objects for corresponding pages should be unloaded and saved to disk if there are no references to these objects.</p><p>For <strong>Linux</strong>, when this property value is set to PFP\_KeepInMemory, the image documents and layouts for unused pages are not saved to disk.</p><p>This property is PFP\_Auto by default.</p><p>For <strong>macOS</strong>, this property value is ignored. The image documents and layouts for unused pages are always unloaded on disk.</p><p>For <strong>Windows</strong>: To unload and save to disk the ImageDocument and the Layout objects for separate pages of the document, use the <a href="/fine-reader/engine/api-reference/document-related-objects/frpage/flush-method">IFRPage::Flush</a> method for the corresponding pages.</p><p>This property is PFP\_Auto by default.</p></td></tr><tr><td><p><a name="tempdir" /><strong>TempDir</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">BSTR</a></strong></p></td><td><p>Specifies the path to the folder where the temporary image files in the ABBYY FineReader Engine internal format are stored.</p><p>By default, the value of this property is "%TEMP%\ABBYY FineReader Engine 12".</p></td></tr></tbody></table>

## Methods

| Name                                                                                                                                              | Description                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AddImageDocument](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagedocument-method)                                 | Adds one open image, represented by the [ImageDocument](/fine-reader/engine/api-reference/image-related-objects/imagedocument) object, to the document.                                                                                                                                                   |
| [AddImageFile](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefile-method)                                         | Opens an image file and adds the pages corresponding to the opened file to the document.                                                                                                                                                                                                                  |
| [AddImageFileFromAttachment](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilefromattachment-method)             | Opens an image file from the attachment and adds the pages corresponding to the opened file to the document.                                                                                                                                                                                              |
| [AddImageFileFromMemory](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilefrommemory-method)                     | Opens an image file from the global memory, where it was previously loaded by the user, and adds the pages corresponding to the opened file to the document.                                                                                                                                              |
| [AddImageFileFromStream](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilefromstream-method)                     | Opens an image file from the input stream implemented by the user, and adds the pages corresponding to the opened file to the document.                                                                                                                                                                   |
| [AddImageFileWithPassword](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilewithpassword-method)                 | Opens a password-protected image file and adds the pages corresponding to the opened file to the document.                                                                                                                                                                                                |
| [AddImageFileWithPasswordCallback](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilewithpasswordcallback-method) | Opens an image file using the [IImagePasswordCallback](/fine-reader/engine/api-reference/image-related-objects/iimagepasswordcallback) interface and adds the pages corresponding to the opened file to the document.                                                                                     |
| [AddPage](/fine-reader/engine/api-reference/document-related-objects/frdocument/addpage-method)                                                   | Adds a page to the document.                                                                                                                                                                                                                                                                              |
| [Analyze](/fine-reader/engine/api-reference/document-related-objects/frdocument/analyze-method)                                                   | Performs layout analysis of all pages in the document.                                                                                                                                                                                                                                                    |
| [AnalyzePages](/fine-reader/engine/api-reference/document-related-objects/frdocument/analyzepages-method)                                         | Performs layout analysis of specified pages in a document.                                                                                                                                                                                                                                                |
| [CheckTextLayer](/fine-reader/engine/api-reference/document-related-objects/frdocument/checktextlayer-method)                                     | Checks the text layer on the specified document pages for its presence or reliability.                                                                                                                                                                                                                    |
| [Close](/fine-reader/engine/api-reference/document-related-objects/frdocument/close-method)                                                       | Releases all the resources that were used by the FRDocument object and returns the object into the initial state (as after its creation with the [IEngine::CreateFRDocument](/fine-reader/engine/api-reference/engine-object-iengine-interface/creation-methods/createlessobjectgreater-methods) method). |
| [ConvertFromOldVersion](/fine-reader/engine/api-reference/document-related-objects/frdocument/convertfromoldversion-method)                       | Loads the contents of the FRDocument object, which were saved by the previous versions of ABBYY FineReader Engine, from the specified folder.                                                                                                                                                             |
| [Export](/fine-reader/engine/api-reference/document-related-objects/frdocument/export-method)                                                     | Saves the document into a file in an external format.                                                                                                                                                                                                                                                     |
| [ExportPages](/fine-reader/engine/api-reference/document-related-objects/frdocument/exportpages-method)                                           | Saves the specified pages into a file in an external format.                                                                                                                                                                                                                                              |
| [ExportToMemory](/fine-reader/engine/api-reference/document-related-objects/frdocument/exporttomemory-method)                                     | Saves the document into memory in an external format.                                                                                                                                                                                                                                                     |
| [LoadFromFolder](/fine-reader/engine/api-reference/document-related-objects/frdocument/loadfromfolder-method)                                     | Loads the contents of the FRDocument object, which were saved by ABBYY FineReader Engine 12, from the specified folder.                                                                                                                                                                                   |
| [Preprocess](/fine-reader/engine/api-reference/document-related-objects/frdocument/preprocess-method)                                             | Performs preprocessing of all pages in the document: corrects page orientation, inversion, geometrical distortions, performs page splitting if necessary.                                                                                                                                                 |
| [PreprocessPages](/fine-reader/engine/api-reference/document-related-objects/frdocument/preprocesspages-method)                                   | Performs preprocessing of the specified pages in the document: corrects page orientation, inversion, geometrical distortions, performs page splitting if necessary.                                                                                                                                       |
| [Process](/fine-reader/engine/api-reference/document-related-objects/frdocument/process-method)                                                   | Performs preprocessing, layout analysis, recognition, and page and document synthesis of all pages in the document.                                                                                                                                                                                       |
| [ProcessPages](/fine-reader/engine/api-reference/document-related-objects/frdocument/processpages-method)                                         | Performs preprocessing, layout analysis, recognition, and page and document synthesis of the specified pages in the document.                                                                                                                                                                             |
| [Recognize](/fine-reader/engine/api-reference/document-related-objects/frdocument/recognize-method)                                               | Performs recognition and page synthesis of all pages in the document.                                                                                                                                                                                                                                     |
| [RecognizePages](/fine-reader/engine/api-reference/document-related-objects/frdocument/recognizepages-method)                                     | Performs recognition and page synthesis of the specified pages in the document.                                                                                                                                                                                                                           |
| [SaveToFolder](/fine-reader/engine/api-reference/document-related-objects/frdocument/savetofolder-method)                                         | Saves the contents of the FRDocument object to the specified folder.                                                                                                                                                                                                                                      |
| [SplitPages](/fine-reader/engine/api-reference/document-related-objects/frdocument/splitpages-method)                                             | Splits each of the specified pages of the document into several pages. This method is useful if the page is a double-page spread of a book, or the page contains images of several business cards. The method provides information on how the pages have been split.                                      |
| [Synthesize](/fine-reader/engine/api-reference/document-related-objects/frdocument/synthesize-method)                                             | Performs document synthesis of all pages in the document.                                                                                                                                                                                                                                                 |
| [SynthesizePages](/fine-reader/engine/api-reference/document-related-objects/frdocument/synthesizepages-method)                                   | Performs document synthesis of the specified pages in the document.                                                                                                                                                                                                                                       |

## Related objects

<img src="https://mintcdn.com/abbyy/lsETHFYUFiongXSm/images/fine-reader/engine/frdocument.gif?s=6900fd736eed5657d9f13e75bc946abc" alt="FRDocument" width="453" height="275" data-path="images/fine-reader/engine/frdocument.gif" />[](/fine-reader/engine/api-reference/document-related-objects/businesscard)[](/fine-reader/engine/api-reference/document-related-objects/businesscards)[](/fine-reader/engine/api-reference/language-related-objects/detectedlanguage)[](/fine-reader/engine/api-reference/language-related-objects/detectedlanguages)[](/fine-reader/engine/api-reference/text-related-objects/plaintext)[](/fine-reader/engine/api-reference/document-related-objects/documentinformationdictionaryitem)[](/fine-reader/engine/api-reference/document-related-objects/documentinformationdictionary)[](/fine-reader/engine/api-reference/document-related-objects/documentcontentinfo)[](/fine-reader/engine/api-reference/text-related-objects/plaintext)[](/fine-reader/engine/api-reference/layout-related-objects/layout)[](/fine-reader/engine/api-reference/image-related-objects/imagedocument)[](/fine-reader/engine/api-reference/document-related-objects/frpage)[](/fine-reader/engine/api-reference/document-related-objects/frpages)

[Object Diagram](/fine-reader/engine/api-reference/object-diagram)

## Output parameter

This object is the output parameter of the [CreateFRDocument](/fine-reader/engine/api-reference/engine-object-iengine-interface/creation-methods/createlessobjectgreater-methods) and [CreateFRDocumentFromImage](/fine-reader/engine/api-reference/engine-object-iengine-interface/creation-methods/createfrdocumentfromimage-method) methods of the [Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface) object.

## Input parameter

This object is passed as an input parameter to the following methods:

* [CreateObjectFromDocument](/fine-reader/engine/api-reference/classification-related-objects/classificationengine/createobjectfromdocument-method) method of the [ClassificationEngine](/fine-reader/engine/api-reference/classification-related-objects/classificationengine) object
* [CompareDocuments](/fine-reader/engine/api-reference/document-comparison-objects/comparator/comparedocuments-method) method of the [Comparator](/fine-reader/engine/api-reference/document-comparison-objects/comparator) object
* [OnDocumentChanged](/fine-reader/engine/visual-components-reference/idocumentviewerevents/ondocumentchanged-method) method of the [IDocumentViewerEvents](/fine-reader/engine/visual-components-reference/idocumentviewerevents) interface (for Visual Components)
* [OnDocumentChanged](/fine-reader/engine/visual-components-reference/itextvalidatorevents/ondocumentchanged-method) method of the [ITextValidatorEvents](/fine-reader/engine/visual-components-reference/itextvalidatorevents) interface  (for Visual Components)

## Related Visual Components

<img src="https://mintcdn.com/abbyy/lsETHFYUFiongXSm/images/fine-reader/engine/frdocument_vc.gif?s=acb017c98448982b0535be77fab535f7" alt="FRDocument_VC" width="294" height="79" data-path="images/fine-reader/engine/frdocument_vc.gif" />[](/fine-reader/engine/visual-components-reference/textvalidator#frdocument)[](/fine-reader/engine/visual-components-reference/documentviewer#frdocument)[](/fine-reader/engine/visual-components-reference/supplementary-objects/componentsynchronizer#document)[](/fine-reader/engine/visual-components-reference/textvalidator)[](/fine-reader/engine/visual-components-reference/supplementary-objects/componentsynchronizer)[](/fine-reader/engine/visual-components-reference/documentviewer)

## Samples

<Accordion title="C# code">
  ```csharp theme={null}
  FREngine.IEngine engine;
  // Create document
  FREngine.IFRDocument document = Engine.CreateFRDocument();
  try {
   // Add image file to document
   document.AddImageFile( "D:\\Demo.tif", null, null );
   // Recognize document
   document.Process( null );
   // Save results to rtf with default parameters
   document.Export( "D:\\Demo.rtf", FREngine.FileExportFormatEnum.FEF_RTF, null );
  }
  catch( Exception error )
  {
   ...
  }
  finally {
   // Close document
   document.Close();
  }
  ```
</Accordion>

<Accordion title="C++ (COM) code">
  ```cpp theme={null}
  FREngine::IEnginePtr Engine;
  // Create document
  FREngine::IFRDocumentPtr frDocument = Engine->CreateFRDocument();
  try {
   // Add image file to document
   frDocument->AddImageFile( L"D:\\Demo.tif", 0, 0 );
   // Recognize document
   frDocument->Process( 0 );
   // Save results to rtf with default parameters
   frDocument->Export( L"D:\\Demo.rtf", FREngine::FEF_RTF, 0 );
  } catch( _com_error& e ) {
   ...
   // Close document
   frDocument->Close();
  }
  // Close document
  frDocument->Close();
  ```
</Accordion>

The object is used in almost all [code samples](/fine-reader/engine/guided-tour/samples) except the exception is the [BatchProcessing](/fine-reader/engine/guided-tour/samples#batchprocessing) code sample for Linux Windows.

## See also

[FRPage](/fine-reader/engine/api-reference/document-related-objects/frpage)

[IFRDocumentEvents](/fine-reader/engine/api-reference/document-related-objects/ifrdocumentevents)

[Parallel Processing with ABBYY FineReader Engine](/fine-reader/engine/guided-tour/advanced-techniques/parallel-processing)

[Working with Connectable Objects](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-connectable-objects)

[Working with Properties](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties)
