Compare documents
Leave feedback
On this page
Change detection algorithms of GroupDocs.Comparison allow you to detect changes in different document parts and blocks:
- Text blocks - paragraphs, words and characters
- Tables
- Images
- Shapes etc.
GroupDocs.Comparison highlights detected changes with different colors:
- Added – blue
- Modified – green
- Style – green
- Deleted – red
You can customize the changes styling scheme using different formatting - italic, bold, underlined, strike-through, etc.
To compare two documents, follow these steps:
- Instantiate the
Comparer
object with the source document path or stream. - Call the
add()
method and specify the target document path or stream. - Call the
compare()
method.
The following code snippets show how to compare two documents:
const comparer = new groupdocs.comparison.Comparer(sourcePdfPath)
comparer.add(targetPdfPath);
comparer.compare(resultPdfPath);
The output file is as follows:
const comparer = new groupdocs.comparison.Comparer(new FileInputStream(sourcePdfPath))
comparer.add(new FileInputStream(targetPdfPath));
comparer.compare(resultPdfPath);
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.