Creating custom job items from scratch

Create custom job items from scratch in C# as follows:

  1. Create a new C# project with Class Library template. Set Target framework to .NET Framework 4.6.
  2. With Configuration Manager, create new solution platform; 'x86' or 'x64' depending on your deployed CSDK.
  3. Add Kofax.OmniPageCSDK.IproPlus.JobItem.dll and Kofax.OmniPageCSDK.IproPlus.dll as reference.
  4. Use the Koafx.OmniPage.CSDK.IproPlus namespace.
  5. Derive your class from JobItem and implement abstract class.
  6. You can find an implementation of Ping and GetResult methods in CustomJobItemCS sample.
  7. Implement the Run method that best applies to your project.
    • You can evaluate your job request accessing XElement public property.

    • To access IproPlus Engine and Document through public properties, do not dispose them. Fire a Progress event periodically.

    • If you have a lot of work to do, fire NewObject event occasionally.

    • When the task is finished, fire the Done event.

  8. Make the class COM visible by adding attributes like these:
    ComVisible(true) , Guid("") , ClassInterface(ClassInterfaceType.None)
  9. Implement a static Register function to change COM threading model to apartment model.

    You can find an example in CustomJobItemCS sample.

  10. Unload project and edit it to add a platform specific post build event.
     <PropertyGroup Condition="'$(Platform)' ==
         call "$(DevEnvDir)..\..\vc\bin\vcvars32.bat"
         regasm "$(TargetPath)" /codebase
    <PropertyGroup Condition="'$(Platform)' == 'x64'">
          call "$(DevEnvDir)..\..\vc\bin\amd64\vcvars64.bat"
          regasm "$(TargetPath)" /codebase
    Important Do not use Register for COM interop option.
  11. Build the project.