Compare Encrypted PDF Documents via Java Library
Open Source Java API to Compare two PDF documents and store or display the results in a PDF file with ease.
PDF stands for the Portable Document Format; PDF file format is one of the most commonly used file formats around the globe. PDF is a flexible file format in which you can do things in many different ways to fulfill your organization’s needs. Sometimes it’s required to compare two versions of a PDF file to check what has been changed. The open source Java library PdfCompare helps developers to compare PDF documents inside their own applications. You can easily compare two PDF files and can store or display the results in a PDF file with ease. You can easily ignore specific pages or some areas of the pages during the comparison. You can easily select and load the PDF files you want to compare
There is a simple interactive UI that users can easily start by calling the class Class de.redsix.pdfcompare.Main. The library uses different kinds of markings to differentiate different parts of the PDF document. You can define rectangular areas that can be ignored during the comparison. For that, a file needs to be created, which defines areas to ignore.
Getting Started with PdfCompare
Please use the following command to add the maven dependency in your project.
OpenPDF Maven Dependency
<dependency>
<groupId>de.redsix</groupId>
<artifactId>pdfcompare</artifactId>
<version>...</version> <!-- see current version in the maven central tag above -->
</dependency>
Compare PDF Files Pixel by Pixel
The open source library PdfCompare has included support for comparing PDF files pixel by pixel using Java code. The library is using different types of color schemes to identify different areas of the compared documents. The equal or same pixels of the document is faded a bit. Pixels that differ are marked in red and green. The yellow pixels are showing ignore areas and the edge of the paper areas are marked in magenta color. Pages that were expected, but did not come are marked with a red border. You can easily change the color scheme. For changing the color scheme please include a file known as "application.conf" to the root of the classpath. You can easily specify a new color scheme in HTML-Stlye format inside this file.
Compare Encrypted PDF Documents
The PdfCompare library has provided functionality for comparing encrypted PDF documents inside their own applications using Java commands. To compare password-protected PDF files you need to provide the password of the documents. You can use two methods for this purpose and need to pass the password as a string parameter.
Excluding PDF Areas during Documents Comparison
The open source PdfCompare library gives software developers the capability to exclude certain areas during the comparison of the PDF documents. To exclude an area you need to define that area. You can create a file and define a rectangular area inside that file to be ignored. During the comparison, if the provided exclusion file is not found, it is ignored and the comparison is done without the exclusions.