Hi,
Currently I am using Aspose.Words to compare two PDF documents using below code.
Document baselineDoc = new Document(baselinePdfPath);
Document generatedDoc = new Document(generatedPdfPath);
// There should be no revisions before comparison
baselineDoc.AcceptAllRevisions();
generatedDoc.AcceptAllRevisions();
baselineDoc.Compare(generatedDoc, "Reports PDF Comparison", DateTime.Now);
if (baselineDoc.Revisions.Count.Equals(0))
{
logger.Debug("Both PDF's matches");
return true;
}
else
{
string filePath = Path.Combine(outputFilePath, string.Concat(outputFileName, ".pdf"));
baselineDoc.Save(filePath);
logger.Debug($"There is a mismatch between the PDF's, the differences is saved in the file - {filePath}");
return false;
}
We have Aspose.Total license. Wanted to check is there other ways to compare two PDF documents for equality and print/highlight the differences.
Thanks,