CompareToImages

CompareToImages(string, string, ImageSaveOptions, string, DateTime, CompareOptions)

Compares two documents and saves the differences as images. Each item in the returned array represents a single page of the output rendered as an image.

public static Stream[] CompareToImages(string v1, string v2, ImageSaveOptions imageSaveOptions, 
    string author, DateTime dateTime, CompareOptions compareOptions = null)
ParameterTypeDescription
v1StringThe original document.
v2StringThe modified document.
imageSaveOptionsImageSaveOptionsThe output’s image save options.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.
compareOptionsCompareOptionsDocument comparison options.

See Also


CompareToImages(Stream, Stream, ImageSaveOptions, string, DateTime, CompareOptions)

Compares two documents and saves the differences as images. Each item in the returned array represents a single page of the output rendered as an image.

public static Stream[] CompareToImages(Stream v1, Stream v2, ImageSaveOptions imageSaveOptions, 
    string author, DateTime dateTime, CompareOptions compareOptions = null)
ParameterTypeDescription
v1StreamThe original document.
v2StreamThe modified document.
imageSaveOptionsImageSaveOptionsThe output’s image save options.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.
compareOptionsCompareOptionsDocument comparison options.

Examples

Shows how to compare documents and save results as images.

// There is a several ways to compare documents:
string firstDoc = MyDir + "Table column bookmarks.docx";
string secondDoc = MyDir + "Table column bookmarks.doc";

Stream[] pages = Comparer.CompareToImages(firstDoc, secondDoc, new ImageSaveOptions(SaveFormat.Png), "Author", new DateTime());

using (FileStream firstStreamIn = new FileStream(firstDoc, FileMode.Open, FileAccess.Read))
{
    using (FileStream secondStreamIn = new FileStream(secondDoc, FileMode.Open, FileAccess.Read))
    {
        CompareOptions compareOptions = new CompareOptions();
        compareOptions.IgnoreCaseChanges = true;
        pages = Comparer.CompareToImages(firstStreamIn, secondStreamIn, new ImageSaveOptions(SaveFormat.Png), "Author", new DateTime(), compareOptions);
    }
}

See Also