Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GroupDocsGists/82fb867c30591bb934a44d0f01969fb9 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/82fb867c30591bb934a44d0f01969fb9 to your computer and use it in GitHub Desktop.
// 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