ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.OCR.Exceptions Namespace / OCRException Class
Members Example

In This Topic
    OCRException Class
    In This Topic
    Represents a generic OCR exception.
    Syntax
    Example
    Extract text from a document using a different model
    {
      string docFileName = "c:\\MyData\\MyDocument.jpg";
    
      var ocrOptions = new OCROptions(docFileName);
      ocrOptions.OutputType = OCROutputType.Text;
    
      // set a specific page if necessary
      // (if not set, then all pages are scanned)
      // ocrOptions.Page = pageIdx;
    
      // set the resolution if necessary
      // ocrOptions.Resolution = 400;
    
      // set the language
      // (de.traineddata should be installed at (arcgis_install_folder)\Resources\OCR)
      // if file cannot be found an exception is thrown
      ocrOptions.Model = "de";
    
      try
      {
        var output = await OCRManager.Instance.ExtractFromDocumentAsync(ocrOptions);
        var textOutput = output as OCRTextOutput;
    
        var text = textOutput.Text;
      }
      catch (ArcGIS.Core.OCR.Exceptions.OCRException ex)
      {
      }
    }
    Inheritance Hierarchy

    System.Object
       System.Exception
          ArcGIS.Core.OCR.Exceptions.OCRException

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.8 or higher.
    See Also