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

# CompareDocuments Method of the Comparator Object

This method compares the original document with its copy. Both documents should have already been recognized using, for example, the [Process](/fine-reader/engine/api-reference/document-related-objects/frdocument/process-method) method of the [FRDocument](/fine-reader/engine/api-reference/document-related-objects/frdocument) object (or another method that performs document synthesis).

This method returns the [ComparisonResult](/fine-reader/engine/api-reference/document-comparison-objects/comparisonresult) object that contains all the changes made to the document.

## Syntax

### C++

```csharp theme={null}
HRESULT CompareDocuments(
  IFRDocument*         RefDocument,
  IFRDocument*         UserDocument,
  IIntsCollection*     RefPageIndices,
  IIntsCollection*     UserPageIndices,
  IComparisonResult**  Result
);
```

### C\#

```csharp theme={null}
IComparisonResult CompareDocuments(
  IFRDocument          RefDocument,
  IFRDocument          UserDocument,
  IIntsCollection      RefPageIndices,
  IIntsCollection      UserPageIndices
);
```

### Visual Basic .NET

```csharp theme={null}
Function CompareDocuments( _
  RefDocument As IFRDocument, _
  UserDocument As IFRDocument, _
  RefPageIndices As IIntsCollection, _
  UserPageIndices As IIntsCollection _
) As IComparisonResult
```

## Parameters

RefDocument

\[in] Refers to the [FRDocument](/fine-reader/engine/api-reference/document-related-objects/frdocument) object that contains the original document to compare. This parameter must not be NULL.

UserDocument

\[in] Refers to the [FRDocument](/fine-reader/engine/api-reference/document-related-objects/frdocument) object that contains the document copy to compare. This parameter must not be NULL.

RefPageIndices

\[in] This parameter refers to the [IntsCollection](/fine-reader/engine/api-reference/supplementary-objects-and-methods/intscollection) object which specifies the indices of the pages to be compared with the pages in the original document.

UserPageIndices

\[in] This parameter refers to the [IntsCollection](/fine-reader/engine/api-reference/supplementary-objects-and-methods/intscollection) object which specifies the indices of the pages to be compared with the pages in the document copy.

Result

\[out, retval] A pointer to IComparisonResult\* pointer variable that receives the interface pointer of the output [ComparisonResult](/fine-reader/engine/api-reference/document-comparison-objects/comparisonresult) object.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## See also

[Comparator](/fine-reader/engine/api-reference/document-comparison-objects/comparator)
