Sample Code: Formatted Document Conversion (OneStep)
The sample function below will take as input the path to an image file as well as the path where the output document should be placed. This code utilizes OmniPage SDK's "OneStep" workflow to load the input document, OCR it and export the output to a formatted file in a single function call.
References needed:
Nuance.OmniPage.CSDK.ArgTypes.dll
Nuance.OmniPage.CSDK.Objects.dll
private static void FormattedOneStep(string inputFile, string outputFile)
{
//Initialize the engine and enable formatted output
Engine.Init("CompanyName", "ProductName", true);
//Create a settings collection to manage OCR settings
using (SettingCollection settings = new SettingCollection())
{
//Set the recognition module to our 3-way engine which is the most accurate
settings.DefaultRecognitionModule = RECOGNITIONMODULE.RM_OMNIFONT_PLUS3W;
//Set the output format to searchable PDF
settings.OutputFormats.Current = "Converters.Text.PDFImageOnText";
//Other common outputs:
//Text - "Converters.Text.Text
//Word Document - "Converters.Text.DOCX"
//XML - "Converters.Text.XML"
//HTML - "Converters.Text.Html40
//Perform "one-step" document conversion
settings.ProcessPages(outputFile, new string[] { inputFile });
}
}