Compare PDF document using Aspose.Words

Hi Team,

I tried comparing two PDF document and created a document showing difference between those document.
Comparison document not seems to be correct and not highlighting correct area.

I am using aspose words using dot net. Below is some sample code, Please provide some reference links or how we can get the valid compression document

 MemoryStream c = new MemoryStream();

 Stream mockedPdfDocumentStream = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FabBinderReport.Pdf"));

Stream a = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Output.Pdf"));

var docB = new Document(mockedPdfDocumentStream);

Document docA = new Document(a);

// There should be no revisions before comparison.
docA.AcceptAllRevisions();
docB.AcceptAllRevisions();
docA.Compare(docB, "Author Name", DateTime.Now);

// Saving comparison document
docA.Save(c, "pdf");

Thanks
Gaurav

@gauravgarg04 The code for comparing documents looks like this:

// Open documents
Document docA = new Document("docA.docx");
Document docB = new Document("docB.docx");

// Accept revisions if any
docA.AcceptAllRevisions();
docB.AcceptAllRevisions();

// Compare documents.
docA.Compare(docB, "Author Name", DateTime.Now);

// Save output.
docA.Save("out.docx");

Please see our documentation for more information:
https://docs.aspose.com/words/net/compare-documents/

Also, please note, Aspose.Words is designed to work with MS Word documents. MS Word documents are flow documents and they have structure very similar to Aspose.Words Document Object Model. But on the other hand PDF documents are fixed page format documents. While loading PDF document, Aspose.Words converts Fixed Page Document structure into the Flow Document Object Model. Unfortunately, such conversion does not guaranty 100% fidelity.

Regarding PDF document comparison using Aspose.Words, though PDF document might look the same visually, their structure might be different, that leads into the different DOM build by Aspose.Words and as a result the differences in document comparison.

Could you please attach your test documents here for testing? We will check them and provide you more information.