Free Support Forum - groupdocs.com

Compare method returns null using .NET

Hi.


I’m using trial version to evaluate some features. I downloaded example code and I’m tryng to compare two documents. When I invoke Compare() method, it returns always null.

What it means? Two documents are differents. This is the code:

Stream sourceStream = File.Open(Path.Combine(Common.sourcePath, Common.sourceFile), FileMode.Open, FileAccess.Read);
Stream targetStream = File.Open(Path.Combine(Common.targetPath, Common.targetFile), FileMode.Open, FileAccess.Read);

ComparisonSettings set = new ComparisonSettings();
set.DetailLevel = DetailLevel.Hight;

// Get instance of GroupDocs.Comparison.Comparer and call method Compare.
GroupDocs.Comparison.Comparer comparison = Common.getComparison();
ICompareResult result = comparison.Compare(sourceStream, targetStream, set);

// get result document as stream.
Stream stream = result.GetStream();

sourceStream.Close();
targetStream.Close();
stream.Close();

Thx

@daniele.busseda

We’d recommend you to download latest release of the API. We’ve made document comparison process a lot easier in it. Have a look at the migration notes. Below is the simplified code to compare two PDF files:

using (Comparer comparer = new Comparer(“source.pdf”))
{
    comparer.Add(“target.pdf”);
    comparer.Compare(“result.pdf”);
}

If you face any issue, you can share the problematic files with us along-with the exception details.

i have used same code which you have mention but i am getting blank output pdf .api version 20.6.0.0 as well as i have attach sample project could you please check and let me know result.pdf (35.6 KB)

1 Like

@zshaikh

Please have a look at API evaluation and limitation article. We can see that you have raised a query in purchase forum about temporary license, you will be soon assisted there.
Meanwhile, can you please share the source and target PDF files with us. We’ll make sure that output is blank due to API limitation.