Style Changes Not Highlighted


#1

I am using a trial license for compare for java 18.6 and I have turned on summary report and style change detection in the settings. I am using 2 PDFs with a small number of changes between them. The three big style changes I made was one line I change the font, a paragraph was indented, and some words were highlighted in the signature block. It detected 26 changes but only highlighted 5 words whose casing changed in the address block. The font change, paragraph indent, and highlighting were not highlighted green. I also don’t know what the 26 changes detected were since only a few things were highlighted green. I have attached a zip file with the two PDFs compared and the results.

The code used was:
private static void compareFiles(String file1, String file2, String reportPath)
{
ComparisonSettings settings = null;
Comparer comparer = null;
ICompareResult result = null;
String suffix = null;

	try
	{
		comparer = new Comparer();
		settings = new ComparisonSettings();
		settings.setGenerateSummaryPage(true);
		settings.setStyleChangeDetection(true);
		
		suffix = file1.substring(file1.lastIndexOf("."));
		if(!suffix.startsWith("."))
		{
			suffix = "." + suffix;
		}

		result = comparer.compare(new FileInputStream(file1), new FileInputStream(file2), settings);
		result.saveDocument(reportPath + suffix);
		
		System.out.println("Finished compare " + result.getChanges().length + " changes.");
		System.out.println("Report written to " + reportPath + suffix);
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}
}

StyleChangesNotHighlighted.zip (263.4 KB)


#2

@sherter,

We’ve logged this issue in our internal issue tracking system with ID:COMPARISONJAVA-425. We’re further investigating it. As we have any update, we shall apprise you.


#3

@sherter,

Your reported issue is resolved in latest release of the API. Please integrate 18.6.1 in your project.


#4

The report is better with 18.6.1 but it is still not finding a lot of changes. It is putting the inserted footer up into the middle of the address block at the top of the page and it is missing the font change and the indent change. I have attached a zip file with the two PDFs being compared and the result using the same code as above but with the 18.6.1 library.2018-07-27_PDFCompare.zip (291.2 KB)


#5

@sherter,

Thank you for your feedback. We shall further investigate, improve the comparison results and update you.


#6

@sherter,

Please download and integrate 18.6.2 version of the API. It will improve your comparison results.


#7

Thanks for the update, I haven’t had a chance to test it yet. I will get to it as soon as I can.


#8

@sherter,

Alright.


#9

I re-ran the test and the count now matches the number of colored items. However, the footer, which didn’t change, is still shown as a change in part of the address block at the top and the font change, paragraph indent, and highlighting are still not found as format changes. I have attached the PDFs used for the compare and the report generated. The same code as before was used to compare the two PDFs. 2018-09-05_PDFCompare.zip (291.2 KB)


#10

@sherter,

When API compares both source and target documents. It finds footer in one document while missing in the other document. Hence, footer is shown in the output (as it is a difference/change between two docs).

If there is a change found, you can highlight it. For instance, an inserted item style change can be highlighted as follows:

settings.getInsertedItemsStyle().setColor(Color.RED);


#11

Sorry it took so long to get back to you.

I see the footer is, indeed, a change. It is in PDF1 and not in PDF2. It still doesn’t explain why it is shown as a deleted element at the top of the page in the middle of the address block.

I used the following to set the style changed color to yellow

settings.getStyleChangedItemsStyle().setColor(Color.YELLOW);

and I get a summary with yellow stating there are no style changes. There is one style change. In PDF1 the paragraph above the signature is indented and in PDF2 it is not indented.

I have included a zip file with the original two PDFs and the report PDF.
2018-18-2018_PDFCompare.zip (291.4 KB)


#12

@sherter,

We are investigating these issues. As we have any further update, you shall be notified.