Created
July 17, 2019 08:12
-
-
Save GroupDocsGists/82fb867c30591bb934a44d0f01969fb9 to your computer and use it in GitHub Desktop.
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
// For complete examples and data files, please go to https://github.com/groupdocs-comparison/GroupDocs.Comparison-for-Java | |
Comparer comparer = new Comparer(); | |
ComparisonSettings cs = new ComparisonSettings(); | |
cs.setStyleChangeDetection(true); | |
//compare document | |
ICompareResult result = comparer.compare(sourcePath, targetPath, cs); | |
result.saveDocument(resultPath); | |
//get list of pages | |
List<PageImage> resultImages = comparer.convertToImages(resultPath); | |
//save them as bitmap to separate folder | |
if (!new File(savePath + "/Result Pages").exists()) | |
new File(savePath + "/Result Pages").mkdir(); | |
for (PageImage image : resultImages) | |
{ | |
BufferedImage bitmap = ImageIO.read(image.getPageStream()); | |
ImageIO.write(bitmap, "png", new FileOutputStream(savePath + "/Result Pages/result_" + image.getPageNumber() + ".png")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment