// USE CASE: Using a configured FlexiCapture project to recognize image files public static void Using_a_configured_FlexiCapture_project_to_recognize_image_files(IEngine engine) { trace("Open the sample project..."); IProject project = engine.OpenProject("D:\\Users\\seral\\Desktop\\SampleImages\\SampleProject\\DocScan1CProject\\DocScan1CProject.fcproj"); try { trace("Add a new batch..."); IBatch batch = project.Batches.AddNew("DocScan1C"); trace("Open the batch..."); batch.Open(); try { IStringsCollection filePaths = engine.CreateStringsCollection(); filePaths.Add(SamplesFolder + "1134.pdf"); filePaths.Add(SamplesFolder + "Scan_07_θη_06.bmp"); //filePaths.Add(SamplesFolder + "Scan_02_θη_06.jpg"); // filePaths.Add(SamplesFolder + "Scan_08_θη_06.jpg");*/ IStringsCollection badFiles = engine.CreateStringsCollection();; ILongsCollection docIds = engine.CreateLongsCollection(); trace("Add image files to the batch..."); batch.AddImages(filePaths, -1, null, null, badFiles, docIds); trace("Recognize all images in the batch..."); batch.Recognize(null, RecognitionModeEnum.RM_ReRecognizeMinimal, null); trace("Export the results..."); IExportParams exportParams = engine.CreateExportParams(ExportDestinationTypeEnum.EDT_File); exportParams.IgnoreRuleErrors = true; exportParams.FileExportParams.RootPath = "D:\\Users\\seral\\Desktop\\FCEExport"; exportParams.FileExportParams.FileFormat = FileExportFormatEnum.FEF_XML; exportParams.FileExportParams.FileNamePattern = "<DocumentDefinition>"; exportParams.FileExportParams.CreateSeparateFilesForRepeatableItems = true; exportParams.FileExportParams.FileOverwriteRule = FileOverwriteRuleEnum.FOR_Rename; batch.Export(null, exportParams); trace("Close and delete the batch..."); } finally { batch.Close(); // Before the batch could be deleted, it has to be closed project.Batches.DeleteAll(); } trace("Close the project..."); } finally { project.Close(); } }
void collectionEvents_OnCollectionChanged(bool reloaded, ILongsCollection added, ILongsCollection deleted, ILongsCollection modified) { try { if (reloaded) { trace(name + ": RESET"); } else { string addedTxt = added != null ? " ADDED:" + added.Count : ""; string deletedTxt = deleted != null ? " DELETED:" + deleted.Count : ""; string modifiedTxt = modified != null ? " MODIFIED:" + modified.Count : ""; trace(name + ":" + addedTxt + deletedTxt + modifiedTxt); } } catch (Exception e) { trace(e.Message); } }
void collectionEvents_OnCollectionChanged( bool reloaded, ILongsCollection added, ILongsCollection deleted, ILongsCollection modified ) { try { if( reloaded ) { trace( name + ": RESET" ); } else { string addedTxt = added != null ? " ADDED:" + added.Count : ""; string deletedTxt = deleted != null ? " DELETED:" + deleted.Count : ""; string modifiedTxt = modified != null ? " MODIFIED:" + modified.Count : ""; trace( name + ":" + addedTxt + deletedTxt + modifiedTxt ); } } catch( Exception e ) { trace( e.Message ); } }