Skip to content
Guides

Overlay Comparison

Overlay Comparison is used to visually compare pages of different documents. It’s helpful for things such as construction plans and detailed drawings, as well as other content that requires precise placement.

Setting a different stroke color is usually necessary when trying to compare documents. During the document comparison, the two documents overlap, and repetitive positions become a uniform color due to color overlay. Inconsistent parts retain distinct stroke colors, thereby displaying all differences between the two documents prominently.

The color settings here only affect the stroke objects and do not alter the color of other elements, such as text or images.

The steps to perform overlay comparison are as follows:

  1. Open the two documents to be compared.
  2. Create a document comparison object.
  3. Compare the two documents and generate a comparison document.
  4. Save the comparison document.

This example shows how to perform overlay comparison:

C#
CPDFDocument document = CPDFDocument.InitWithFilePath("File1.pdf");
CPDFDocument dewDocument = CPDFDocument.InitWithFilePath("File2.pdf");
CPDFCompareOverlay compareOverlay = new CPDFCompareOverlay(document, "1-5", dewDocument, "1-5");
compareOverlay.Compare();
CPDFDocument comparisonDocument = compareOverlay.ComparisonDocument();
comparisonDocument.WriteToFilePath("Save Path");
  • You can modify the stroke colors for the two versions of the document by using the SetOldDocumentStrokeColor and SetNewDocumentStrokeColor properties.

  • You can also change the blend mode used to overlay the new version of a document on top of the old one by changing the SetBlendMode property.

  • Trying out various stroke colors and blend modes will result in different-looking comparison documents, and you can make sure the final result fits your needs.