Get all changes including deletion, insertion and modification for all elements in PDF like images or tables in Java

Hi,

I am evaluating “GroupDocs.comparison”, what we need,

(1)Input two PDF files
(2)Do “compare” for all elements in sequence in pdf files
(3)Return List where xxxx = insertion/deletion/modification

Current sample code only write out the diff to a pdf file.

(1)Could you provide a sample code which return
Return List where xxxx = information about insertion/deletion/modification

(2)We have “Aspose.Total.java” license, if we only purchase
“GroupDoc.Comparison”, what is the price?

Thanks!

Ruhong

@ruhongcai,

Thanks for taking interest in GroupDocs.Comparison for Java and posting your concerns. Yes, currently API compares two documents and write out the difference or highlight the style changes to a PDF document.
This is how you can highlight the style change:

ComparisonSettings settings = new ComparisonSettings();   
settings.setGenerateSummaryPage(false);
settings.getInsertedItemsStyle().setColor(Color.BLACK);
settings.getDeletedItemsStyle().setColor(Color.red);

Using this code you can get differences, style changes (with highlighting) and comparison summary in the output document.

However, returning just the information about style changes is concerned, we are investigating this at our end. Your investigation ticket ID is COMPARISONJAVA-445. As we have any update on it, we shall notify you.

You have to purchase GroupDocs.Total for Java or GroupDocs.Comparison for Java license in order to utilize this API.
Please see license types and you can buy license from here. Furthermore, if you have any purchase related inquiry, feel free to post here.

@ruhongcai,

We have an update regarding COMPARISONJAVA-445. You can return style changes as follows:

 ComparisonSettings settings = new ComparisonSettings();
 settings.setStyleChangeDetection(true);
 Comparer comparer = new Comparer();
 ICompareResult result = comparer.compare("source file path", settings);
 ChangeInfo[] changes = result.getChanges();
 final ArrayList<ChangeInfo> changeInfos = new ArrayList<>(Arrays.asList(changes));
 CollectionUtils.filter(changeInfos, new Predicate() {
     @Override
      public boolean evaluate(Object o) {
           ChangeInfo changeInfo = (ChangeInfo) o;
           return changeInfo.getType() == TypeChanged.StyleChanged;
      }
    });
 int iasd = changeInfos.size();

You have to add common-collection dependency in order to use filter method:

 <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.2</version>
 </dependency>