Disable image comparison in PDF documents

On this page


GroupDocs.Comparison allows you to disable image comparison in PDF documents.

By default, the CompareImagesPdf option is true. Follow these steps to turn off image comparison:

  1. Instantiate the Comparer object. Specify the source file path or stream.
  2. Call the Add method. Specify the target file path or stream.
  3. Instantiate the CompareOptions object. Set the CompareImagesPdf property to false;
  4. Set the ImagesInheritanceMode property to ImagesInheritance.Source or ImagesInheritance.Target;
  5. Call the Comparer method. Specify the CompareOptions object from the previous step.

The following code snippet shows how to disable image comparison in PDF documents:

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...

using (Comparer comparer = new Comparer("source.pdf"))
{
    comparer.Add("target.pdf");
    CompareOptions compareOptions = new CompareOptions()
    {
        CompareImagesPdf = false,
        ImagesInheritanceMode = ImagesInheritance.Target
    }
    comparer.Compare("result.pdf", compareOptions);
}

The result is as follows:

On this page