How to Use Progress Tracking

IronOCR provides an event for subscribing to track the progress of the OCR (Optical Character Recognition) reading operation. These properties offer valuable information about the progress, duration, and completion status of the OCR job, enabling applications to effectively monitor and report on the OCR process.

Get Started with IronOCR

Start using IronOCR in your project today with a free trial.

First Step:
green arrow pointer



Progress Tracking Example

The OcrProgress event can be subscribed to receive progress updates on the reading process. The event will pass an instance containing information about the progress of the OCR job, such as the start time, total pages, progress as a percentage, duration, and end time. Let's use the following document as our sample: "Experiences in Biodiversity Research: A Field Course" by Thea B. Gessler, Iowa State University.

:path=/static-assets/ocr/content-code-examples/how-to/progress-tracking-progress-tracking.cs
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();

// Subscribe to OcrProgress event
ocrTesseract.OcrProgress += (_, ocrProgressEventsArgs) =>
{
    Console.WriteLine("Start time: " + ocrProgressEventsArgs.StartTimeUTC.ToString());
    Console.WriteLine("Total pages number: " + ocrProgressEventsArgs.TotalPages);
    Console.WriteLine("Progress(%) | Duration");
    Console.WriteLine("    " + ocrProgressEventsArgs.ProgressPercent + "%     | " + ocrProgressEventsArgs.Duration.TotalSeconds + "s");
    Console.WriteLine("End time: " + ocrProgressEventsArgs.EndTimeUTC.ToString());
    Console.WriteLine("----------------------------------------------");
};

using var input = new OcrInput();
input.LoadPdf("Experiences-in-Biodiversity-Research-A-Field-Course.pdf");

// Progress events will fire during the read operation
var result = ocrTesseract.Read(input);
Imports IronOcr
Imports System

Private ocrTesseract = New IronTesseract()

' Subscribe to OcrProgress event
Private ocrTesseract.OcrProgress += Sub(underscore, ocrProgressEventsArgs)
	Console.WriteLine("Start time: " & ocrProgressEventsArgs.StartTimeUTC.ToString())
	Console.WriteLine("Total pages number: " & ocrProgressEventsArgs.TotalPages)
	Console.WriteLine("Progress(%) | Duration")
	Console.WriteLine("    " & ocrProgressEventsArgs.ProgressPercent & "%     | " & ocrProgressEventsArgs.Duration.TotalSeconds & "s")
	Console.WriteLine("End time: " & ocrProgressEventsArgs.EndTimeUTC.ToString())
	Console.WriteLine("----------------------------------------------")
End Sub

Private input = New OcrInput()
input.LoadPdf("Experiences-in-Biodiversity-Research-A-Field-Course.pdf")

' Progress events will fire during the read operation
Dim result = ocrTesseract.Read(input)
$vbLabelText   $csharpLabel
Progress update

Information from the Event

  • ProgressPercent: Represents the progress of the OCR job as a percentage of pages completed. It ranges from 0 to 100.
  • TotalPages: Indicates the total number of pages being processed by the OCR engine.
  • PagesComplete: Specifies the number of pages where OCR reading has been fully completed. This count may increase gradually as pages are processed.
  • Duration: Represents the total duration of the OCR job, indicating the time taken for the entire process to complete. It's measured in TimeSpan format. This time is updated every time the event is triggered.
  • StartTimeUTC: Denotes the date and time when the OCR job started, represented in Coordinated Universal Time (UTC) format.
  • EndTimeUTC: Represents the date and time when the OCR job was 100% completed in UTC format. This property is null while OCR is still in progress and gets populated once the OCR process is finished.

Frequently Asked Questions

How can I track the progress of an OCR job in C#?

You can track the progress of an OCR job in C# by subscribing to the OcrProgress event in IronOCR. This event provides updates on the percentage of completion, duration, and number of pages processed.

What is the role of the OcrProgress event in OCR operations?

The OcrProgress event in IronOCR allows developers to receive real-time updates on the OCR job's status, including progress percentage, total duration, start and end times, and total pages being processed.

What information does the ProgressPercent property provide?

The ProgressPercent property in IronOCR indicates the progress of the OCR job as a percentage, providing a clear view of how much of the task is completed, ranging from 0 to 100.

How do I obtain the total duration of an OCR process?

You can obtain the total duration of an OCR process by accessing the Duration property in IronOCR, which updates every time the OcrProgress event is triggered, reflecting the time taken for the entire process.

Can I determine when an OCR job starts and ends?

Yes, IronOCR provides the StartTimeUTC and EndTimeUTC properties, which denote the start and completion times of the OCR job in UTC format, respectively.

How can I handle multiple pages during OCR processing?

In IronOCR, you can handle multiple pages by using the TotalPages and PagesComplete properties to track the total number of pages being processed and the number of pages that have been fully processed.

What is a practical example of using progress tracking in OCR?

A practical example involves subscribing to the OcrProgress event while processing a sample document titled 'Experiences in Biodiversity Research: A Field Course.' This demonstrates tracking the progress, duration, and completion status in IronOCR.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.