public class OcrOptions extends Object
Recognition is done by Aspose.OCR for Java, which GroupDocs.Comparison declares as a dependency. It is not bundled into the GroupDocs.Comparison jar, so it has to be on the classpath when these options are enabled.
Example usage:
try (Comparer comparer = new Comparer(sourceImage)) {
comparer.add(targetImage);
OcrOptions ocr = new OcrOptions();
ocr.setEnabled(true);
CompareOptions compareOptions = new CompareOptions();
compareOptions.setOcr(ocr);
comparer.compare(resultImage, compareOptions);
}
CompareOptions.setOcr(OcrOptions)| Constructor and Description |
|---|
OcrOptions()
Initializes a new instance of the
OcrOptions class. |
| Modifier and Type | Method and Description |
|---|---|
OcrDisplayMode |
getDisplayMode()
Gets how the comparison result is laid out.
|
OcrLanguage |
getLanguage()
Gets the language of the text to recognize.
|
String |
getResourcesPath()
Gets the folder that contains the recognition models.
|
boolean |
isDisableResourceDownloads()
Gets a value indicating whether to prevent downloading recognition models.
|
boolean |
isEnabled()
Gets a value indicating whether to compare the recognized text.
|
void |
setDisableResourceDownloads(boolean value)
Sets a value indicating whether to prevent downloading recognition models.
|
void |
setDisplayMode(OcrDisplayMode value)
Sets how the comparison result is laid out.
|
void |
setEnabled(boolean value)
Sets a value indicating whether to compare the recognized text.
|
void |
setLanguage(OcrLanguage value)
Sets the language of the text to recognize.
|
void |
setResourcesPath(String value)
Sets the folder that contains the recognition models.
|
public OcrOptions()
OcrOptions class.public OcrDisplayMode getDisplayMode()
OcrDisplayMode.SIDE_BY_SIDE.public OcrLanguage getLanguage()
Languages other than OcrLanguage.LATIN require a recognition model that is not
included in the package. See setDisableResourceDownloads(boolean) and
setResourcesPath(String).
OcrLanguage.LATIN.public String getResourcesPath()
The setting applies to the entire process.
null to use the default location.public boolean isDisableResourceDownloads()
Models are downloaded from the Aspose.OCR resource repository and stored in
getResourcesPath(). The setting applies to the entire process.
true to fail when a required recognition model is not available locally;
false to download it. Default is false.public boolean isEnabled()
true to compare the recognized text; false to compare the images by
their pixels. Default is false.public void setDisableResourceDownloads(boolean value)
value - true to fail when a required recognition model is not available
locally; false to download it.public void setDisplayMode(OcrDisplayMode value)
value - The layout of the result image.public void setEnabled(boolean value)
value - true to compare the recognized text; false to compare the
images by their pixels.public void setLanguage(OcrLanguage value)
value - The language or script the documents are written in.public void setResourcesPath(String value)
value - The path to the folder, or null to use the default location.Copyright © 2026 Aspose Pty Ltd. All rights reserved.