LEADTOOLS For .NET Class Library Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.28
Using the LEADTOOLS Workflow Ocr Activity

Take the following steps to create and run a program that uses the LEADTOOLS OCR activity to recognize the text in an image, then save the result as PDF:

  1. Start Visual Studio .NET.
  2. Choose File >New >Project... from the menu.
  3. In the New Project dialog box, choose either "Visual C#" or "Visual Basic" then "Workflow" in the projects type list, and choose "Sequential Workflow Console Application" in the Templates List.
  4. Type the project name as "WfOcrTest" in the Project Name field, and then choose OK. If desired, type a new location for your project or select a directory using the Browse button, and then choose OK.
  5. In the "Solution Explorer" window, right-click on the "References" folder, and select "Add Reference..." from the context menu. In the "Add Reference..." dialog box, select the ".NET" tab and browse to the "<LEADTOOLS_INSTALLDIR>\Bin\DotNet\Win32" folder and select the following DLLs:
    • Leadtools.Workflow.Raster.dll
    • Leadtools.Workflow.Ocr.dll
  6. Click Select and then click OK to add the above DLLs to the application.
  7. To add the LEADTOOLS activities to your toolbox, right-click the toolbox and select "Choose Items". In the "Choose Toolbox Items" dialog, go the "Activities" tab, and browse for and select the activities from same DLLs from previous step.
  8. Double-click your project's workflow to open it for editing, then select the UnlockSupportActivity and OcrActivity activities from the toolbox and place them on the workflow.
  9. Add a handler to the workflow's Initialized event and add this lines to it:
                [C#]
                 
                unlockSupportActivity1.UnlockedFeatures.Add(Leadtools.Workflow.Raster.RasterSupportType.OcrPlus, "Replace with your own key here"); 
                unlockSupportActivity1.UnlockedFeatures.Add(Leadtools.Workflow.Raster.RasterSupportType.OcrPlusPdfOutput, "Replace with your own key here");
                [Visual Basic] 
                unlockSupportActivity1.UnlockedFeatures.Add(Leadtools.Workflow.Raster.RasterSupportType.OcrPlus, "Replace with your own key here") 
                unlockSupportActivity1.UnlockedFeatures.Add(Leadtools.Workflow.Raster.RasterSupportType.OcrPlusPdfOutput, "Replace with your own key here")
                
    
  10. Set the SourceFile property of the OcrActivity to a path to an image file such as "\LEADTOOLS Images\OCR1.TIF".
  11. Set the TargetFile property of the OcrActivity to "c:\result.pdf"
  12. Set the output folder of the project .exe to where LEADTOOLS .Net DLLs are installed. For example: <LEADTOOLS_INSTALLDIR>\Bin\Dotnet\Win32.
  13. Build, and Run the program to test it.