// USE CASE: Verifying recognized documents public static void Verifying_recognized_documents( IEngine engine ) { trace( "Prepare documents and add them to a collection..." ); IDocumentsCollection documentsToVerify = engine.CreateDocumentsCollection(); documentsToVerify.Add( PrepareNewRecognizedDocument( engine ) ); documentsToVerify.Add( PrepareNewRecognizedDocument( engine ) ); traceBegin( "Run verification..." ); IVerificationSession verificationSession = engine.CreateVerificationSession( documentsToVerify ); try { trace( "Change verification options if required..." ); IVerificationOptions verificationOptions = verificationSession.Options; verificationOptions.VerifyExtraSymbols = true; trace( "Open a set of documents (a work set) and collect objects that need to be verified..." ); IVerificationWorkSet verificationWorkSet = verificationSession.NextWorkSet(); while( verificationWorkSet != null ) { trace( "For each group of objects show the objects to the verification operator for confirmation..." ); IVerificationGroup verificationGroup = verificationWorkSet.NextGroup(); while( verificationGroup != null ) { trace( "Verification Group: " + verificationGroup.Description + " (confirm all)" ); for( int i = 0; i < verificationGroup.Count; i++ ) { IVerificationObject verificationObject = verificationGroup.Item( i ); if( verificationObject.Type == VerificationObjectTypeEnum.VOT_Group ) { verificationObject.State = VerificationObjectStateEnum.VOS_Confirmed; } else { IContextVerificationObject contextVerificationObject = verificationObject.AsContextVerificationObject(); // If field value is modified during verification you should recheck rules for // the corresponding field contextVerificationObject.CheckRules(); contextVerificationObject.Field.Value.SetVerified(); } } verificationGroup = verificationWorkSet.NextGroup(); } trace( "Save verification results (all documents in the set)..." ); verificationWorkSet.Commit(); trace( "Open the next set of documents..." ); verificationWorkSet = verificationSession.NextWorkSet(); } trace( "Close the session..." ); } finally { // Verification consumes considerable system resources (many simultaniously // open and loaded documents and images). So it is VERY important that // these resources should be released in timely manner and not left for // garbage collector to manage. verificationSession.Close(); } trace( "Check that the documents do not need verification now..." ); for( int i = 0; i < documentsToVerify.Count; i++ ) { IDocument document = documentsToVerify.Item( i ); recursiveCheckVerified( engine, document.Sections ); } traceEnd( "OK" ); traceEnd( "OK" ); }