Skip to content

Commit bc70cef

Browse files
Updated document comparison examples
1 parent 73a0337 commit bc70cef

10 files changed

Lines changed: 494 additions & 295 deletions

File tree

  • content/english/net/document-comparison

content/english/net/document-comparison/_index.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,20 @@ url: /net/document-comparison/
1010

1111
## Document Comparison Tutorials
1212
### [Generate Page Previews for Resultant Document](./generate-page-previews-resultant-document/)
13+
Learn how to generate document previews using GroupDocs.Comparison for .NET. Compare documents efficiently and accurately.
1314
### [Generate Page Previews for Source Document](./generate-page-previews-source-document/)
15+
Learn how to utilize Groupdocs.Comparison for .NET to streamline document comparison processes in your C# projects effectively.
1416
### [Generate Page Previews for Target Document](./generate-page-previews-target-document/)
17+
Generate page previews for target documents efficiently using GroupDocs.Comparison for .NET. Follow our step-by-step guide for seamless document comparison.
1518
### [Clean Resources After Page Previews](./clean-resources-after-page-previews/)
19+
Learn how to compare documents using GroupDocs.Comparison for .NET step by step. Enhance your .NET applications with efficient document management.
1620
### [Set Specific Image Sizes for Previews](./set-specific-image-sizes-for-previews/)
21+
Effortlessly integrate document comparison functionality into your .NET applications with GroupDocs.Comparison for .NET.
1722
### [Compare Documents from Path - GroupDocs.Comparison for .NET](./compare-documents-from-path/)
23+
Effortlessly compare documents in various formats with GroupDocs.Comparison for .NET. Save time and ensure accuracy in legal, academic, and business tasks.
1824
### [Compare Documents from Stream - GroupDocs.Comparison for .NET](./compare-documents-from-stream/)
25+
Streamline document comparison with GroupDocs.Comparison for .NET. Compare documents effortlessly and ensure accuracy across files.
1926
### [Compare Protected Documents from Path - GroupDocs.Comparison for .NET](./compare-protected-documents-from-path/)
20-
### [Compare Protected Documents from Stream - GroupDocs.Comparison for .NET](./compare-protected-documents-from-stream/)
27+
Effortlessly compare protected documents in .NET using GroupDocs.Comparison for seamless integration. Enhance your document management workflow.
28+
### [Compare Protected Documents from Stream - GroupDocs.Comparison for .NET](./compare-protected-documents-from-stream/)
29+
Learn how to compare protected documents from streams using GroupDocs.Comparison for .NET. Streamline your document comparison process effortlessly.

content/english/net/document-comparison/clean-resources-after-page-previews/_index.md

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,71 @@
22
title: Clean Resources After Page Previews
33
linktitle: Clean Resources After Page Previews
44
second_title: GroupDocs.Comparison .NET API
5-
description:
5+
description: Learn how to compare documents using GroupDocs.Comparison for .NET step by step. Enhance your .NET applications with efficient document management.
66
type: docs
77
weight: 13
88
url: /net/document-comparison/clean-resources-after-page-previews/
99
---
10+
## Introduction
11+
In the world of .NET development, managing and comparing documents efficiently is essential for various applications, from legal firms to educational institutions. Fortunately, with tools like GroupDocs.Comparison for .NET, developers can streamline the process of comparing documents with ease. In this tutorial, we'll explore how to utilize GroupDocs.Comparison for .NET to compare documents step by step.
12+
## Prerequisites
13+
Before diving into the tutorial, make sure you have the following prerequisites in place:
14+
1. GroupDocs.Comparison for .NET: Download and install the library from [here](https://releases.groupdocs.com/comparison/net/).
15+
2. .NET Development Environment: Ensure you have a working .NET development environment set up on your machine.
16+
3. Document Samples: Prepare the source and target documents you want to compare.
17+
18+
## Import Namespaces
19+
In your .NET project, begin by importing the necessary namespaces to access the functionalities of GroupDocs.Comparison for .NET.
1020

11-
## Complete Source Code
1221
```csharp
1322
using System;
1423
using System.IO;
24+
```
1525

16-
namespace GroupDocs.Comparison.Examples.CSharp.AdvancedUsage
26+
## Step 1: Define Output Directory and File Name
27+
```csharp
28+
string outputDirectory = "Your Document Directory";
29+
string outputFileName = Path.Combine(outputDirectory, "RESULT.pptx");
30+
```
31+
## Step 2: Initialize Comparer and Add Documents
32+
```csharp
33+
using (Comparer comparer = new Comparer("SOURCE.pptx"))
1734
{
18-
using GroupDocs.Comparison;
19-
using GroupDocs.Comparison.Options;
20-
21-
/// <summary>
22-
/// This example demonstrates how to get document previews with user memory clean code
23-
/// </summary>
24-
class GetPagePreviewsResouresCleaning
35+
comparer.Add("TARGET.pptx");
36+
```
37+
## Step 3: Perform Comparison and Generate Output
38+
```csharp
39+
comparer.Compare(File.Create(outputFileName));
40+
```
41+
## Step 4: Generate Document Previews
42+
```csharp
43+
Document document = new Document(File.OpenRead(outputFileName));
44+
PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
2545
{
26-
/// <summary>
27-
/// User example code for releasing image stream memory
28-
/// </summary>
29-
/// <param name="pageNumber"></param>
30-
/// <param name="stream"></param>
31-
private static void UserReleaseStreamMethod(int pageNumber, Stream stream)
32-
{
33-
Console.WriteLine($"Releasing memory for page: {pageNumber}");
34-
stream.Close();
35-
}
36-
37-
public static void Run()
38-
{
39-
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
40-
Console.WriteLine("[Example Advanced Usage] # GetPagePreviewsResouresCleaning : how to get document previews with user memory clean code\n");
41-
42-
string outputDirectory = "Your Document Directory";
43-
string outputFileName = Path.Combine(outputDirectory, "RESULT.pptx");
44-
45-
using (Comparer comparer = new Comparer("SOURCE.pptx"))
46-
{
47-
comparer.Add("TARGET.pptx");
48-
comparer.Compare(File.Create(outputFileName));
49-
Document document = new Document(File.OpenRead(outputFileName));
50-
PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
51-
{
52-
var pagePath = Path.Combine(Constants.SamplesPath, $"result_{pageNumber}.png");
53-
return File.Create(pagePath);
54-
});
55-
previewOptions.PreviewFormat = PreviewFormats.PNG;
56-
previewOptions.PageNumbers = new int[] { 1, 2 };
57-
previewOptions.ReleasePageStream = UserReleaseStreamMethod;
58-
document.GeneratePreview(previewOptions);
59-
}
60-
Console.WriteLine($"\nDocument previews generated successfully.\nCheck output in {outputDirectory}.");
61-
}
62-
}
46+
var pagePath = Path.Combine(Constants.SamplesPath, $"result_{pageNumber}.png");
47+
return File.Create(pagePath);
48+
});
49+
previewOptions.PreviewFormat = PreviewFormats.PNG;
50+
previewOptions.PageNumbers = new int[] { 1, 2 };
51+
previewOptions.ReleasePageStream = UserReleaseStreamMethod;
52+
document.GeneratePreview(previewOptions);
6353
}
64-
6554
```
55+
## Step 5: Display Success Message
56+
```csharp
57+
Console.WriteLine($"\nDocument previews generated successfully.\nCheck output in {outputDirectory}.");
58+
```
59+
60+
## Conclusion
61+
In conclusion, GroupDocs.Comparison for .NET provides a robust solution for comparing documents effortlessly within .NET applications. By following the steps outlined in this tutorial, developers can seamlessly integrate document comparison functionality into their projects, enhancing productivity and efficiency.
62+
## FAQ's
63+
### Is GroupDocs.Comparison for .NET compatible with different document formats?
64+
Yes, GroupDocs.Comparison for .NET supports a wide range of document formats, including DOCX, PPTX, XLSX, PDF, and more.
65+
### Can I customize the output format of compared documents?
66+
Absolutely, GroupDocs.Comparison for .NET offers flexibility in choosing the output format according to your requirements.
67+
### Is there a trial version available for testing purposes?
68+
Yes, you can explore the features of GroupDocs.Comparison for .NET with a free trial available [here](https://releases.groupdocs.com/).
69+
### How can I get support for any issues or queries related to GroupDocs.Comparison for .NET?
70+
You can seek assistance from the GroupDocs.Comparison community forum [here](https://forum.groupdocs.com/c/comparison/12).
71+
### Where can I purchase a license for GroupDocs.Comparison for .NET?
72+
You can purchase a license for GroupDocs.Comparison for .NET from [this link](https://purchase.groupdocs.com/buy).

content/english/net/document-comparison/compare-documents-from-path/_index.md

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,59 @@
22
title: Compare Documents from Path - GroupDocs.Comparison for .NET
33
linktitle: Compare Documents from Path - GroupDocs.Comparison for .NET
44
second_title: GroupDocs.Comparison .NET API
5-
description:
5+
description: Effortlessly compare documents in various formats with GroupDocs.Comparison for .NET. Save time and ensure accuracy in legal, academic, and business tasks.
66
type: docs
77
weight: 15
88
url: /net/document-comparison/compare-documents-from-path/
99
---
10+
## Introduction
11+
In today's digital era, document comparison plays a crucial role in various fields, including legal, business, and academia. Whether you're a lawyer comparing contracts, a student reviewing essays, or a business professional examining reports, having a reliable tool for document comparison can save time and ensure accuracy. GroupDocs.Comparison for .NET offers a powerful solution for comparing documents with ease and efficiency. In this tutorial, we'll guide you through the process of comparing documents using GroupDocs.Comparison for .NET.
12+
## Prerequisites
13+
Before diving into the tutorial, ensure you have the following prerequisites in place:
14+
1. GroupDocs.Comparison for .NET Installation: Make sure you have downloaded and installed GroupDocs.Comparison for .NET. You can download the library from the [releases page](https://releases.groupdocs.com/comparison/net/).
15+
2. Basic Understanding of C#: Familiarize yourself with the basics of C# programming language, as this tutorial involves writing C# code snippets.
16+
3. Document Files: Prepare the source and target document files that you want to compare. Supported file formats include DOCX, PDF, PPTX, XLSX, and more.
1017

11-
## Complete Source Code
18+
## Import Namespaces
19+
To begin, you need to import the necessary namespaces into your C# project. These namespaces provide access to the classes and methods required for document comparison.
1220
```csharp
1321
using System;
1422
using System.IO;
15-
16-
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
23+
```
24+
## Step 1: Define Output Directory and Filename
25+
Start by defining the directory where you want the compared document to be saved and specify the output filename.
26+
```csharp
27+
string outputDirectory = "Your Document Directory";
28+
string outputFileName = Path.Combine(outputDirectory, "RESULT.docx");
29+
```
30+
Replace `"Your Document Directory"` with the actual path where you want to save the compared document.
31+
## Step 2: Perform Document Comparison
32+
Now, instantiate the `Comparer` class by providing the path to the source document. Then, use the `Add()` method to add the target document for comparison. Finally, call the `Compare()` method to execute the comparison and save the result to the specified output file.
33+
```csharp
34+
using (Comparer comparer = new Comparer("SOURCE.docx"))
1735
{
18-
/// <summary>
19-
/// This example demonstrates comparing of two documents
20-
/// </summary>
21-
class CompareDocumentsFromPath
22-
{
23-
public static void Run()
24-
{
25-
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
26-
Console.WriteLine("[Example Basic Usage] # CompareDocumentsFromPath : comparing of two documents from path\n");
27-
28-
string outputDirectory = "Your Document Directory";
29-
string outputFileName = Path.Combine(outputDirectory, "RESULT.docx");
30-
31-
using (Comparer comparer = new Comparer("SOURCE.docx"))
32-
{
33-
comparer.Add("TARGET.docx");
34-
comparer.Compare(outputFileName);
35-
}
36-
Console.WriteLine($"\nDocuments compared successfully.\nCheck output in {outputDirectory}.");
37-
}
38-
}
36+
comparer.Add("TARGET.docx");
37+
comparer.Compare(outputFileName);
3938
}
4039
```
40+
Replace `"SOURCE.docx"` and `"TARGET.docx"` with the paths to your source and target documents, respectively.
41+
## Step 3: Display Success Message
42+
After successful comparison, display a message indicating the completion of the process and the location of the output file.
43+
```csharp
44+
Console.WriteLine($"\nDocuments compared successfully.\nCheck output in {outputDirectory}.");
45+
```
46+
This message will provide users with confirmation and guidance on where to find the compared document.
47+
48+
## Conclusion
49+
In conclusion, GroupDocs.Comparison for .NET offers a seamless solution for comparing documents in various formats. By following the simple steps outlined in this tutorial, you can effortlessly compare documents and streamline your workflow. Whether you're dealing with legal documents, academic papers, or business reports, GroupDocs.Comparison empowers you to ensure accuracy and efficiency in your document comparison tasks.
50+
## FAQ's
51+
### Is GroupDocs.Comparison for .NET compatible with all document formats?
52+
GroupDocs.Comparison supports a wide range of document formats, including DOCX, PDF, PPTX, XLSX, and more. However, it's essential to refer to the documentation for the latest list of supported formats.
53+
### Can I customize the output format and appearance of compared documents?
54+
Yes, GroupDocs.Comparison provides options for customizing the output format and appearance of compared documents. You can adjust settings such as change tracking, formatting styles, and output file type according to your preferences.
55+
### Does GroupDocs.Comparison offer batch processing capabilities?
56+
Yes, GroupDocs.Comparison allows batch processing of multiple documents, enabling users to compare multiple files simultaneously and efficiently.
57+
### Is technical support available for GroupDocs.Comparison users?
58+
Yes, GroupDocs.Comparison users can access technical support through the [support forum](https://forum.groupdocs.com/c/comparison/12). Experienced professionals are available to assist with any inquiries or issues users may encounter.
59+
### Can I try GroupDocs.Comparison before purchasing?
60+
Yes, GroupDocs.Comparison offers a free trial version for users to evaluate its features and capabilities before making a purchase decision [here](https://releases.groupdocs.com/). The trial version allows users to test the functionality and compatibility of the software.

content/english/net/document-comparison/compare-documents-from-stream/_index.md

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,64 @@
22
title: Compare Documents from Stream - GroupDocs.Comparison for .NET
33
linktitle: Compare Documents from Stream - GroupDocs.Comparison for .NET
44
second_title: GroupDocs.Comparison .NET API
5-
description:
5+
description: Streamline document comparison with GroupDocs.Comparison for .NET. Compare documents effortlessly and ensure accuracy across files.
66
type: docs
77
weight: 16
88
url: /net/document-comparison/compare-documents-from-stream/
99
---
10+
## Introduction
11+
In today's fast-paced world, where information is abundant and changes are constant, ensuring accuracy and consistency across documents is paramount. Whether you're in the legal field, finance sector, or any other industry where document integrity is crucial, GroupDocs.Comparison for .NET offers a robust solution to streamline the comparison process.
12+
## Prerequisites
13+
Before diving into using GroupDocs.Comparison for .NET, there are a few prerequisites you need to have in place:
14+
1. Install .NET Framework: Ensure you have the .NET Framework installed on your system. You can download it from the Microsoft website.
15+
2. Download GroupDocs.Comparison for .NET: Visit the [download link](https://releases.groupdocs.com/comparison/net/) to obtain the latest version of GroupDocs.Comparison for .NET.
16+
3. Access Documentation: Familiarize yourself with the library's functionalities by referring to the [documentation](https://reference.groupdocs.com/comparison/net/).
17+
4. Basic Understanding of C#: This tutorial assumes you have a basic understanding of C# programming language.
1018

11-
## Complete Source Code
19+
## Import Namespaces
20+
Before getting started with comparing documents using GroupDocs.Comparison for .NET, you need to import the necessary namespaces into your project:
1221
```csharp
1322
using System;
1423
using System.IO;
15-
16-
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
17-
{
18-
/// <summary>
19-
/// This example demonstrates comparing of two documents
20-
/// </summary>
21-
class CompareDocumentsFromStream
22-
{
23-
public static void Run()
24-
{
25-
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
26-
Console.WriteLine("[Example Basic Usage] # CompareDocumentsFromStream : comparing of two documents from stream\n");
27-
28-
string outputDirectory = "Your Document Directory";
29-
string outputFileName = Path.Combine(outputDirectory, "RESULT.docx");
30-
31-
using (Comparer comparer = new Comparer(File.OpenRead("SOURCE.docx")))
32-
{
33-
comparer.Add(File.OpenRead("TARGET.docx"));
34-
comparer.Compare(File.Create(outputFileName));
35-
}
36-
Console.WriteLine($"\nDocuments compared successfully.\nCheck output in {outputDirectory}.");
37-
}
38-
}
39-
}
4024
```
25+
Now that you have set up the prerequisites and imported the required namespaces, let's break down the process of comparing documents into multiple steps:
26+
## Step 1: Define Output Directory and Filename
27+
First, specify the directory where you want the compared document to be saved and the output filename:
28+
```csharp
29+
string outputDirectory = "Your Document Directory";
30+
string outputFileName = Path.Combine(outputDirectory, "RESULT.docx");
31+
```
32+
## Step 2: Initialize Comparer Object
33+
Next, create an instance of the `Comparer` class by passing the source document as a parameter:
34+
```csharp
35+
using (Comparer comparer = new Comparer(File.OpenRead("SOURCE.docx")))
36+
```
37+
## Step 3: Add Target Document
38+
Add the document you want to compare against the source document using the `Add` method:
39+
```csharp
40+
comparer.Add(File.OpenRead("TARGET.docx"));
41+
```
42+
## Step 4: Perform Comparison
43+
Execute the comparison process by calling the `Compare` method and specifying the output file:
44+
```csharp
45+
comparer.Compare(File.Create(outputFileName));
46+
```
47+
## Step 5: Display Confirmation Message
48+
Finally, display a message confirming the successful comparison and the location of the output file:
49+
```csharp
50+
Console.WriteLine($"\nDocuments compared successfully.\nCheck output in {outputDirectory}.");
51+
```
52+
53+
## Conclusion
54+
GroupDocs.Comparison for .NET simplifies the tedious task of document comparison, allowing users to effortlessly identify differences and ensure document integrity. By following the steps outlined in this tutorial, you can seamlessly integrate document comparison capabilities into your .NET applications.
55+
## FAQ's
56+
### Can GroupDocs.Comparison for .NET compare documents of different formats?
57+
Yes, GroupDocs.Comparison for .NET supports comparing documents in various formats such as DOCX, PDF, PPTX, and more.
58+
### Is there a free trial available for GroupDocs.Comparison for .NET?
59+
Yes, you can avail of a free trial of GroupDocs.Comparison for .NET by visiting the [website](https://releases.groupdocs.com/).
60+
### Can I customize the comparison settings?
61+
Absolutely, GroupDocs.Comparison for .NET offers a range of customization options to tailor the comparison process according to your requirements.
62+
### Does GroupDocs.Comparison for .NET support document encryption?
63+
Yes, the library supports comparing encrypted documents while maintaining data security.
64+
### Where can I seek support or assistance with GroupDocs.Comparison for .NET?
65+
You can visit the [support forum](https://forum.groupdocs.com/c/comparison/12) dedicated to GroupDocs.Comparison for .NET to seek assistance from the community or submit your queries.

0 commit comments

Comments
 (0)