←Select platform

JobName Property

Summary
Gets or sets the optional job name.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public string JobName { get; set; } 
@property (nonatomic, copy, nullable) NSString *jobName; 
public String getJobName() 
public void setJobName(String value) 
public: 
property String^ JobName { 
   String^ get(); 
   void set (    String^ ); 
} 
JobName # get and set (OcrAutoRecognizeJobData) 

Property Value

A String that contains the optional job name. If tracing is enabled with IOcrAutoRecognizeManager.EnableTrace, then the engine will use this value in the trace messages. If this member is a null reference, then the trace will show the generic [Untitled] name next to the trace messages.

Remarks

Note: The maximum length for this string is 79 characters. Strings longer than 79 characters are truncated to 79 characters.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Ocr; 
using Leadtools.Document.Writer; 
using Leadtools.Forms.Common; 
using Leadtools.WinForms; 
 
private AutoResetEvent _jobFinishedEvent; 
 
public void RunJobAsyncExample() 
{ 
   string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"); 
   string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.pdf"); 
 
   // Create an instance of the engine 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
   { 
      // Start the engine using default parameters 
      Console.WriteLine("Starting up the engine..."); 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
 
      IOcrAutoRecognizeManager ocrAutoRecognizeManager = ocrEngine.AutoRecognizeManager; 
 
      // Create the job 
      OcrAutoRecognizeJobData ocrJobData = new OcrAutoRecognizeJobData(tifFileName, DocumentFormat.Pdf, pdfFileName); 
      ocrJobData.JobName = "MyJob"; 
      IOcrAutoRecognizeJob ocrJob = ocrAutoRecognizeManager.CreateJob(ocrJobData); 
 
      // Create the event 
      _jobFinishedEvent = new AutoResetEvent(false); 
 
      // Run the job in a thread and wait for it to be done 
      // We will use the JobCompleted event to get notified when 
      // the job is finished 
      ocrAutoRecognizeManager.JobCompleted += new EventHandler<OcrAutoRecognizeRunJobEventArgs>(ocrAutoRecognizeManager_JobCompleted); 
      Console.WriteLine("Running the job..."); 
      ocrAutoRecognizeManager.RunJobAsync(ocrJob); 
 
      Console.WriteLine("Waiting for the job to complete..."); 
      _jobFinishedEvent.WaitOne(); 
      Console.WriteLine("Done..."); 
      _jobFinishedEvent.Close(); 
      ocrAutoRecognizeManager.JobCompleted -= new EventHandler<OcrAutoRecognizeRunJobEventArgs>(ocrAutoRecognizeManager_JobCompleted); 
   } 
} 
 
private void ocrAutoRecognizeManager_JobCompleted(object sender, OcrAutoRecognizeRunJobEventArgs e) 
{ 
   // Tell main thread we are done 
   _jobFinishedEvent.Set(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS23\Bin\Common\OcrLEADRuntime"; 
} 
 
import java.io.File; 
import java.io.FileNotFoundException; 
import java.io.FileWriter; 
import java.io.FilenameFilter; 
import java.io.IOException; 
import java.nio.file.Files; 
import java.nio.file.Path; 
import java.nio.file.Paths; 
import java.util.ArrayList; 
import java.util.concurrent.ExecutorService; 
import java.util.concurrent.Executors; 
import java.util.concurrent.atomic.AtomicInteger; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.document.writer.*; 
import leadtools.internal.AutoResetEvent; 
import leadtools.ocr.*; 
 
 
private AutoResetEvent _jobFinishedEvent; 
 
public void OcrAutoRecognizeManagerRunJobAsyncExample() throws InterruptedException { 
   String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String LEAD_VARS_OcrLEADRuntimeDir = "C:\\LEADTOOLS23\\Bin\\Common\\OcrLEADRuntime"; 
   String tifFileName = combine(LEAD_VARS_ImagesDir, "Ocr1.tif"); 
   String pdfFileName = combine(LEAD_VARS_ImagesDir, "Ocr1.pdf"); 
 
   // Create an instance of the engine 
   OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD); 
 
   // Start the engine using default parameters 
   System.out.println("Starting up the engine..."); 
   ocrEngine.startup(null, null, null, LEAD_VARS_OcrLEADRuntimeDir); 
   OcrAutoRecognizeManager ocrAutoRecognizeManager = ocrEngine.getAutoRecognizeManager(); 
 
   // Create the job 
   OcrAutoRecognizeJobData ocrJobData = new OcrAutoRecognizeJobData(tifFileName, DocumentFormat.PDF, pdfFileName); 
   ocrJobData.setJobName("MyJob"); 
   OcrAutoRecognizeJob ocrJob = ocrAutoRecognizeManager.createJob(ocrJobData); 
 
   // Create the event 
   // _jobFinishedEvent = new AutoResetEvent(false); 
   _jobFinishedEvent = new AutoResetEvent(); 
 
   // Run the job in a thread and wait for it to be done 
   // We will use the JobCompleted event to get notified when 
   // the job is finished 
   ocrAutoRecognizeManager.addJobCompletedListener(ocrAutoRecognizeManager_JobCompleted); 
   System.out.println("Running the job..."); 
   ocrAutoRecognizeManager.runJobAsync(ocrJob); 
 
   System.out.println("Waiting for the job to complete..."); 
   _jobFinishedEvent.waitOne(); 
 
   System.out.println("Done..."); 
   _jobFinishedEvent.close(); 
 
   ocrAutoRecognizeManager.removeJobCompletedListener(ocrAutoRecognizeManager_JobCompleted); 
   ocrEngine.dispose(); 
} 
 
OcrAutoRecognizeRunJobListener ocrAutoRecognizeManager_JobCompleted=new OcrAutoRecognizeRunJobListener(){ 
 
   @Override public void onJob(OcrAutoRecognizeRunJobEvent e) { 
      _jobFinishedEvent.set(); 
   } 
    
}; 
Requirements

Target Platforms

Help Version 23.0.2024.4.19
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Ocr Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.