Develop a custom job item from scratch
Create custom job items from scratch in C# as follows:
- Create a new C# project with Class Library template. Set Target framework to .NET Framework 4.6.
- With Configuration Manager, create new solution platform; 'x86' or 'x64' depending on your deployed CSDK.
- Add OmniPageCSDK.IproPlus.JobItem.dll and OmniPageCSDK.IproPlus.dll as reference.
- Use the Koafx.OmniPage.CSDK.IproPlus namespace.
- Derive your class from JobItem and implement abstract class.
- You can find an implementation of Ping and GetResult methods in CustomJobItemCS sample.
-
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.
-
-
Make the class COM visible by adding attributes like these:
ComVisible(true) , Guid("") , ClassInterface(ClassInterfaceType.None)
-
Implement a static Register function to change COM threading model to apartment model.
You can find an example in CustomJobItemCS sample.
-
Unload project and edit it to add a platform specific post build event.
<PropertyGroup Condition="'$(Platform)' == 'x86'"> <PostBuildEvent> "C:\Windows\Microsoft.NET\Framework\v$(MSBuildRuntimeVersion)\RegAsm.exe" "$(TargetPath)" /codebase </PostBuildEvent> </PropertyGroup> <PropertyGroup Condition="'$(Platform)' == 'x64'"> <PostBuildEvent> "C:\Windows\Microsoft.NET\Framework64\v$(MSBuildRuntimeVersion)\RegAsm.exe" "$(TargetPath)" /codebase </PostBuildEvent> </PropertyGroup>
Do not use Register for COM interop option.
- Build the project.