Hello Team,
I am using GroupDocs in a .NET Core application to compare two files, but I am facing some issues:
- HTML Comparison Issue
-
In the result file, images and tables are not visible in the result file.
-
Labels and titles are being swapped in the result file.
2.Example:*
Original:
---
Converted Result:
---
- PDF Comparison Issue: When comparing PDF files with just 20 pages, the resulting compared file contains over 300 pages.
I have uploaded the sample files along with their corresponding compared files to a shared OneDrive folder and provided the link to that folder.
CompareFiles
Here is the code snippet I am currently using for the comparison:
await using (var inputFile1 = new FileStream(filePath1, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true))
{
using (Comparer comparer = new Comparer(inputFile1))
{
await using var inputFile2 = new FileStream(filePath2, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true);
comparer.Add(inputFile2);
await using var outputStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.None, bufferSize: 4096, useAsync: true);
comparer.Compare(outputStream);
}
}
Details:
Could you please provide guidance on how to properly convert these files to HTML?
Thank you.
Best regards,
@koc-it-support
It seems you are encountering several issues while using GroupDocs for file comparison in your .NET Core application. Let’s address each of your concerns:
1. HTML Comparison Issues
- Images and Tables Not Visible: This could be due to the way the HTML content is being processed during the comparison. Ensure that the images and tables are correctly referenced in the original HTML files. If they are linked externally, make sure the links are accessible.
- Labels and Titles Being Swapped: This might be a result of how the comparison engine interprets the structure of the HTML. You may want to check if the HTML is well-formed and adheres to standards, as malformed HTML can lead to unexpected results.
2. PDF Comparison Issue
- Excessive Pages in Resulting File: If the comparison of a 20-page PDF results in over 300 pages, it could be due to the way the comparison engine is handling the content. This might happen if there are many small changes or if the comparison settings are not optimized. You can try adjusting the comparison options to reduce the sensitivity of the comparison or to ignore certain elements like headers and footers.
Suggested Code Adjustments
To improve your comparison results, consider using CompareOptions
to customize the comparison behavior. Here’s an example of how you might implement this:
using System;
using System.IO;
using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
public class FileComparer
{
public async Task CompareFiles(string filePath1, string filePath2, string outputPath)
{
await using (var inputFile1 = new FileStream(filePath1, FileMode.Open, FileAccess.Read))
{
using (Comparer comparer = new Comparer(inputFile1))
{
await using var inputFile2 = new FileStream(filePath2, FileMode.Open, FileAccess.Read);
comparer.Add(inputFile2);
// Set comparison options
var compareOptions = new CompareOptions
{
HeaderFootersComparison = false, // Ignore headers and footers
// Add other options as needed
};
await using var outputStream = new FileStream(outputPath, FileMode.Create, FileAccess.Write);
comparer.Compare(outputStream, new SaveOptions(), compareOptions);
}
}
}
}
Additional Resources
For more detailed guidance, you can refer to the official documentation for GroupDocs.Comparison for .NET, which provides comprehensive information on loading documents, comparison options, and handling various file formats.
If you continue to experience issues, consider sharing your specific HTML and PDF files with the support team for more tailored assistance.
Conclusion
By adjusting your comparison settings and ensuring your HTML is well-formed, you should be able to resolve the issues you’re facing. If you have further questions or need additional help, feel free to ask!
Sources:
[1]: GroupDocs.Comparison for .NET - Documentation
@koc-it-support
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): TOTALNET-209
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
hi @koc-it-support ,
Thank you for your detailed request.
Regarding the HTML comparison issues:
We were able to reproduce the problems with missing images in the result file and also the incorrect ordering of label and value elements. These issues are currently being addressed and are expected to be fixed in GroupDocs.Comparison version 25.4.
As for your note about tables not being visible, I’d appreciate it if you could clarify this part—whether the issue is with specific table content, structure, or formatting—so we can investigate it properly.
Regarding the PDF comparison, this is a known issue that our team is currently working on.
We’ll keep you updated as fixes become available. Please let us know if you have any additional details or questions.