API document comparison result is differ from live demo in Aspose web site

Hello.

I am trying to compare two documents using aspose.net word 21.4
However, the result is differ from that of live demo in Aspose web site as shown in the attachments

string d1 = "11.pdf";
string d2 = "22.pdf";
string comparisonDocument = "result from net.pdf";
int added = 0;
int deleted = 0;

// Load both documents in Aspose.Words
Document doc1 = new Document(d1);
Document doc2 = new Document(d2);
Document docComp = new Document(d1);

doc1.Compare(doc2, "a", DateTime.Now);
doc1.Save(comparisonDocument);

11.pdf (23.9 KB)
22.pdf (24.2 KB)
result from net.pdf (32.4 KB)
result from live demo.pdf (34.7 KB)

Please let me know how to get the same result.

Thanks.

@likydoky To get the desired result please call Document.UpdatePageLayout before saving document tp PDF. See the following code:

string d1 = @"C:\Temp\11.pdf";
string d2 = @"C:\Temp\22.pdf";
string comparisonDocument = @"C:\Temp\out.pdf";

// Load both documents in Aspose.Words
Document doc1 = new Document(d1);
Document doc2 = new Document(d2);

doc1.Compare(doc2, "a", DateTime.Now);
doc1.UpdatePageLayout();
doc1.Save(comparisonDocument);

Since this is undesired behavior, I have logged this problem as WORDSNET-23313. We will investigate the issue and let you know once it is resolved.

The issues you have found earlier (filed as WORDSNET-23313) have been fixed in this Aspose.Words for .NET 22.7 update also available on NuGet.