activities
latest
false
Document Understanding Activities
Last updated Oct 29, 2024

OCRScrapeBase Class

Definition

  • Namespace: UiPath.OCR.Contracts.Scrape
  • Assembly: UiPath.OCR.Contracts

Description

An abstract class that defines the behavior of an IOCRActivity in a screen scraping operation.

Members

Constructors
  • OCRScrapeBase(UiPath.OCR.Contracts.Activities.IOCRActivity) - Initializes a new instance of the OCR scrape engine. The constructor argument is an Activity that implements the IOCRActivity.
Methods
  • CreateOcrEngineActivity(System.Activities.InArgument<System.Drawing.Image>) - Returns a new OCR Activity object with the specified Image set as an InArgument.
  • GetScrapeArguments() System.Collections.Generic.Dictionary<string, object> - Collects all the UiPath.OCR.Contracts.Activities.IOCRActivity arguments from the scrape control. These arguments is used to run the UiPath.OCR.Contracts.Activities.IOCRActivity, PerformOCR method and to fill the activity arguments when the activity is created to be used in a workflow.
  • GetScrapeControl() - Gets the control that is shown on the screen.
  • GetScrapeControl(UiPath.OCR.Contracts.Scrape.ScrapeEngineUsages) - Returns the UserControl that can be used to configure this OCR engine.
  • OCRScrapeBase(UiPath.OCR.Contracts.Activities.IOCRActivity) - Activity constructor.
  • ScrapeOCRAsync(System.Drawing.Bitmap) - Asynchronously performs OCR on the specified Image.
  • ScrapeOCRAsync(System.Drawing.Bitmap, UiPath.OCR.Contracts.Scrape.ScrapeEngineUsages, System.Threading.CancellationToken) - Asynchronously performs OCR on the specified Image. Can be canceled. Allows the caller to specify whether the OCR should be performed in Screen or Document mode.
Properties
  • Name - Custom display the name given to this OCR. This name is visible in certain drop-down controls.
  • Priority - Custom priority is given to this OCR. Lower values indicate higher priority. This determines the ordering of OCR engines in certain drop-down controls.

Code Sample

internal class SampleOCRScrape : OCRScrapeBase
    {
        private readonly ScrapeEngineUsages _usage;
        private readonly SampleScrapeControl _sampleScrapeControl = new SampleScrapeControl();

        public override ScrapeEngineUsages Usage { get; } = ScrapeEngineUsages.Document | ScrapeEngineUsages.Screen;

        public SampleOCRScrape(IOCRActivity ocrEngineActivity, ScrapeEngineUsages usage) : base(ocrEngineActivity)
        {
            _usage = usage;
        }

        public override ScrapeControlBase GetScrapeControl()
        {
            return _sampleScrapeControl;
        }

        public override Dictionary<string, object> GetScrapeArguments()
        {
            return new Dictionary<string, object>
            {
                { nameof(SampleOCRAsyncCodeActivity.CustomInput), _sampleScrapeControl.SampleInput }
            };
        }
    }internal class SampleOCRScrape : OCRScrapeBase
    {
        private readonly ScrapeEngineUsages _usage;
        private readonly SampleScrapeControl _sampleScrapeControl = new SampleScrapeControl();

        public override ScrapeEngineUsages Usage { get; } = ScrapeEngineUsages.Document | ScrapeEngineUsages.Screen;

        public SampleOCRScrape(IOCRActivity ocrEngineActivity, ScrapeEngineUsages usage) : base(ocrEngineActivity)
        {
            _usage = usage;
        }

        public override ScrapeControlBase GetScrapeControl()
        {
            return _sampleScrapeControl;
        }

        public override Dictionary<string, object> GetScrapeArguments()
        {
            return new Dictionary<string, object>
            {
                { nameof(SampleOCRAsyncCodeActivity.CustomInput), _sampleScrapeControl.SampleInput }
            };
        }
    }
  • Definition
  • Description
  • Members
  • Code Sample

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.