Related blog post:
Last active
April 7, 2023 04:37
-
-
Save GroupDocsGists/2cddf5b323d6041b25311cb05a0347e1 to your computer and use it in GitHub Desktop.
Compare PDF Documents, Find Differences, and Accept or Reject Changes using Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accept and reject identified changes by comparing PDF documents using Java | |
Comparer comparer = new Comparer("path/document-1.pdf"); | |
comparer.add("path/document-2.pdf"); | |
ChangeInfo[] changes = comparer.getChanges(); | |
changes[0].setComparisonAction(ComparisonAction.REJECT); | |
changes[1].setComparisonAction(ComparisonAction.ACCEPT); | |
comparer.applyChanges("path/accept-reject-change.pdf", new ApplyChangeOptions(changes)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compare Multiple PDF Documents using Java | |
Comparer comparer = new Comparer("path/document-1.pdf"); | |
comparer.add("path/document-2.pdf"); | |
comparer.add("path/document-3.pdf"); | |
comparer.add("path/document-4.pdf"); | |
comparer.compare("path/multiple-pdf-comparison-result.pdf"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compare Two PDF Documents and Highlight Changes using Java | |
Comparer comparer = new Comparer("path/document-ver1.pdf"); | |
comparer.add("path/document-ver2.pdf"); | |
comparer.compare("path/comparison-result.pdf"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compare Password Protected PDF Documents using Java | |
Comparer comparer = new Comparer("path/protected-document-ver1.pdf", new LoadOptions("SourceFilePassword")); | |
comparer.add("path/protected-document-ver2.pdf", new LoadOptions("TargetFilePassword")); | |
comparer.compare("path/protected-files-comparison-result.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment