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:
- Start Visual Studio .NET.
- Choose File >New >Project... from the menu.
- 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.
- 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.
- 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 "C:\LEADTOOLS 17.5\Bin\DotNet\Win32" folder and select the following DLLs:
- Leadtools.Workflow.Raster.dll
- Leadtools.Workflow.Ocr.dll
- Click Select and then click OK to add the above DLLs to the application.
- 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.
- 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.
- 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")
- Set the SourceFile property of the OcrActivity to a path to an image file such as "\LEADTOOLS Images\OCR1.TIF".
- Set the TargetFile property of the OcrActivity to "c:\result.pdf"
- Set the output folder of the project .exe to where LEADTOOLS .Net DLLs are installed. For example: C:\LEADTOOLS 17.5\Bin\Dotnet\Win32.
- Build, and Run the program to test it.