Compare two documents with different footer sections using Java

When comparing pdf files, both having some difference in the footer section in page number 2. The diff output file generated by the comparison API shows inserted/deleted items in the header of page number 3, not in page no 2. here i am attaching the snapshots.comparisonfile1_snap.png (20.2 KB)
comparisonfile2_snap.png (19.6 KB)
resultDifference_snap.PNG (91.1 KB)

1 Like

@sruthy77,

In order to investigate this behavior, we need following details:

  • API platform (.NET or Java)
  • API version that you integrated in the project (e.g. 19.9, 18.10)
  • Sample code
  • Problematic source and target PDF files

Platform: Java
Version: 19.6

Sample Code:

public static void compareFiles(String file1, String file2) throws Exception {
ICompareResult result = null;
try {
License license = new License();
license.setLicense(“C:\Users\ag41365\Desktop\Documents\ProductLicense\GroupDocs.Comparison.lic”);
if (License.isValidLicense()) {
Comparer comparison = new Comparer();
ComparisonSettings settings = new ComparisonSettings();
settings.setDetailLevel(3);
settings.setStyleChangeDetection(false);
settings.setOriginalSize(settings.getOriginalSize());
settings.setShowDeletedContent(true);
settings.setGenerateSummaryPage(true);
settings.setUseFramesForDelInsElements(true);
settings.getInsertedItemsStyle().setFontColor(Color.BLUE);
result = comparison.compare(file1, file2, settings);
}
} catch(com.groupdocs.comparison.internal.c.a.pd.exceptions.IndexOutOfRangeException e) {
e.printStackTrace();
}
finally {
try {
result.saveDocument(“C:\Users\ag41365\Desktop\Documents\Content_Diff.pdf”);
System.out.println(“Files have been successfully compared…”);
} catch(NullPointerException e) {
System.out.println(e.getMessage());
}
}
}

pdf files are attaching here.source files are named as file1 and file2. and target filecomparedFile.pdf (3.5 MB)
file1.pdf (1.3 MB)
file2.pdf (1.5 MB)
is named as comparedfile.

@sruthy77,

This issue is reproduced at our end. Hence, it has been logged in our internal issue tracking system with ID: COMPARISONJAVA-762. We are now investigating it. As there is any update, you’ll be notified.

if you can fix this issue, we would consider buying your product as it solves our current business requirement

1 Like

@sruthy77,

We are still investigating it. You’ll be notified about the outcomes soon.

@sruthy77,

Can you please look into this resultant.pdf (3.5 MB) file and let us know if this output is satisfying.

the provided resultant pdf file still has the same bug. can you please looking into the issue .

Can we have a working session? Please let me know your availability.

@sruthy77,

Please see this screenshot.JPG (34.3 KB). On source document page 2 there is text in footer and on target document (page 2) there is nothing in footer.
Now, API is showing this difference on top of next page. We are further investigating this issue. You’ll be notified about the outcomes soon.

@sruthy77,

On further investigation its been observed that in the source document the content at bottom of the page 2 cannot be defined as a footer. It is defined as a paragraph. And this paragraphs is moved to page 3 in target document that is why you are getting comparison results on top of page 3. Please see this image.png (119.7 KB).

Whether it is a footer or a paragraph, the error in the second page should be shown in the second page of the compared file.

@sruthy77,

Sorry for the inconvenience you are facing. But this scenario is document specific. The content has been moved to 3 page and changed in the target. Therefore this content is on page 3 as a result.