GroupDocs.Comparison for .NET is a powerful document comparison API that supports more than 50 file formats and allows .NET developers to easily compare different types of documents such as PDF, Word, Excel, PowerPoint, HTML, images, CAD drawings, email messages and more. Use it to detect and highlight differences in text, formatting, styles, shapes and layout, generate comparison results as documents or images, review and accept or reject changes programmatically, and integrate professional document comparison into any .NET application.
$ dotnet add package GroupDocs.Comparison
Product Page | Docs | Demos | API Reference | Examples | Blog | Releases | Free Support | Temporary License
On-premise library to compare documents in applications based on .NET platform. Retrieve the list of changes in the desired format with a line-by-line comparison of content, paragraphs, characters, styles, shapes, and position.
Please note: our library implies the use of .NET programming languages, compatible with CLI infrastructure. For Node.js, Java and Python languages, we recommend you get GroupDocs.Comparison for Node.js, GroupDocs.Comparison for Java and GroupDocs.Comparison for Python, respectively.
Microsoft Word: DOC, DOCM, DOCX, DOT, DOTM, DOTX
Microsoft Excel: XLS, XLT, XLSX, XLTM, XLSB, XLSM, XLSX, CSV
Microsoft PowerPoint: POT, POTX, PPS, PPSX, PPTX, PPT
Microsoft OneNote: ONE
Microsoft Visio: VSDX, VSD, VSS, VST, VDX
OpenDocument: ODT, ODP, OTP, ODS, OTT
Fixed Layout: PDF
AutoCAD: DWG, DXF
Email: EML, EMLX, MSG
Images: BMP, GIF, JPG, JPEG, PNG
Web: HTM, HTML, MHT, MHTML
Text: RTF, TXT
eBook: MOBI, DjVu
Medical Imaging: DCM
Programming Language: CS, JAVA, CPP, JS, PY, RB
Microsoft Windows: Windows Azure, Microsoft Windows Desktop (x86, x64), Microsoft Windows Server (x86, x64)
macOS: Mac OS X
Linux: Ubuntu, OpenSUSE, CentOS, and others
Development Environments: Microsoft Visual Studio (2010 & up), Xamarin.Android, Xamarin.IOS, Xamarin.Mac, MonoDevelop 2.4 and later
Supported Frameworks: .NET Standard 2.0, .NET Framework 2.0 or higher, .NET Core 2.0 or higher, Mono Framework 1.2 or higher
Are you ready to give GroupDocs.Comparison for .NET a try? Simply execute Install-Package GroupDocs.Comparison from Package Manager Console in Visual Studio to fetch & reference GroupDocs.Comparison assembly in your project. If you already have GroupDocs.Comparison for .NET and want to upgrade it, please execute Update-Package GroupDocs.Comparison to get the latest version.
PDF Files in C# Code// Specify the source document
using (Comparer comparer = new Comparer("source.pdf"))
{
// Add one or more target documents
comparer.Add("target.pdf");
// Compare and save result
comparer.Compare("result.pdf", options);
}
JSON Files and get list of changes via C#// Initialize the comparer with the source JSON file
using (Comparer comparer = new Comparer("source.json"))
{
// Add the target JSON file for comparison
comparer.Add("target.json");
// Compare the files (changes are tracked internally)
comparer.Compare();
// Retrieve the list of changes between the source and target files
ChangeInfo[] changes = comparer.GetChanges();
// Iterate through each change and display its details
foreach (ChangeInfo change in changes)
Console.WriteLine("Change Type: {0}, Change ID: {1}, Text: {2}",
change.Type,
change.Id,
change.Text
);
}
DOCX file with C#// Initialize the comparer with the source DOCX file
using (Comparer comparer = new Comparer("source.docx"))
{
// Retrieve document metadata such as page count and size
IDocumentInfo info = comparer.Source.GetDocumentInfo();
// Iterate through each page to display detailed information
for (int i = 0; i < info.PageCount; i++)
{
Console.WriteLine("\n" +
"Page number: {5}\n" + // Current page number
"File type: {0}\n" + // Type of the file
"Number of pages: {1}\n" + // Total page count
"Document size: {2} bytes\n" + // File size in bytes
"Width: {3}\n" + // Width of the current page
"Height: {4} ", // Height of the current page
info.FileType,
info.PageCount,
info.Size,
info.PagesInfo[i].Width,
info.PagesInfo[i].Height,
i + 1 // Adjust page index to 1-based numbering
);
}
}
PNG Files using C# and customize changes styles// Initialize the comparer with the source PNG file
using (Comparer comparer = new Comparer("source.png"))
{
// Add the target PNG file for comparison
comparer.Add("target.png");
// Define custom styles for inserted and deleted items
CompareOptions compareOptions = new CompareOptions()
{
InsertedItemStyle = new StyleSettings()
{
// Highlight inserted items in green
HighlightColor = System.Drawing.Color.Green,
FontColor = System.Drawing.Color.Green,
},
DeletedItemStyle = new StyleSettings()
{
// Highlight deleted items in red
HighlightColor = System.Drawing.Color.Red,
FontColor = System.Drawing.Color.Red,
}
};
// Perform the comparison and save the result with the customized styles
comparer.Compare("result.png", compareOptions);
}
Product Page | Docs | Demos | API Reference | Examples | Blog | Releases | Free Support | Temporary License