←Select platform

CompareDocumentPage Method

Summary

Compares a list of DocumentPageText objects and maps the results to a DocumentDifference

Syntax
C#
VB
C++
public DocumentDifference CompareDocumentPage( 
   IList<DocumentPageText> pages, 
   int pageNumber 
) 
Public Function CompareDocumentPage( 
   ByVal pages As IList(Of DocumentPageText 
), 
   ByVal pageNumber As Integer) As DocumentDifference 
public:  
   DocumentDifference^ CompareDocumentPage( 
      IList<DocumentPageText^>^ pages, 
      Int32 pageNumber 
   ) 

Parameters

pages

List of DocumentPageText objects to compare.

pageNumber

The page number that the DocumentPageText object corresponds to.

Return Value

A DocumentDifference object.

Remarks

Exactly two DocumentPageText objects must be provided.

This method compares the DocumentPageText objects and builds positional information about the differences. If you are just interested in comparing the text, use the CompareText(IList<DocumentPageText>) method instead.

Example
C#
using Leadtools.Document; 
using Leadtools.Document.Compare; 
using Leadtools; 
 
public void CompareDocumentPageExample() 
{ 
   var doc1 = DocumentFactory.LoadFromFile(pathToDocument1, new LoadDocumentOptions()); 
   var doc2 = DocumentFactory.LoadFromFile(pathToDocument2, new LoadDocumentOptions()); 
 
   var textList = new List<DocumentPageText>() 
   { 
      doc1.Pages.First().GetText(), 
      doc2.Pages.First().GetText() 
   }; 
 
   var comparer = new DocumentComparer(); 
   var diffs = comparer.CompareDocumentPage(textList, 1); 
         
   foreach (PageCharactersDifference diff in diffs.Differences) 
   { 
      Console.WriteLine($"Operations: {diff.Operation}"); 
      Console.WriteLine($"Text: {diff.Text}"); 
      foreach(PageCharacter pageChar in diff.Characters) 
      { 
         Console.WriteLine($"    Character: {pageChar.Character}"); 
         Console.WriteLine($"    Character Index: {pageChar.CharacterIndex}"); 
         Console.WriteLine($"    Page Number: {pageChar.PageNumber}"); 
         Console.WriteLine($"    Wordmap Index: {pageChar.WordMapIndex}"); 
      } 
      Console.WriteLine("--------"); 
   } 
} 

Requirements

Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Compare Assembly