A Java CLI tool for validating the compliance of PDF documents with accessibility standards such as WCAG, or PDF/UA.
This tool validates PDF accessibility by checking for issues in tagged PDF documents. It leverages the PDFix SDK (free version) for reading and processing PDF files. Ensuring that PDFs are accessible is crucial for users with disabilities, and this tool helps identify and report potential issues.
Usage:
java -jar validate-pdf-{version}.jar [operation] [arguments]
Operations:
duplicate-mcid : Check for and report duplicate MCID (Marked Content Identifier) entries in a tagged PDF.
Arguments:
-i <file> : Path to a single PDF file to validate.
-d <folder> : Path to a directory of PDF files to validate (will process all PDFs in the folder).
This command validates a PDF file for duplicate MCID entries, which can cause accessibility issues for screen readers.
java -jar target/net.pdfix.validate-pdf-{version}.jar duplicate-mcid -i "path/to/your/file.pdf"
Output
===============================================================================
File: path/to/your/file.pdf
Duplicate MCID Found:
MCID : 9
Page : 26
Index : 32
Type : text
BBox : [240.12, 455.95, 297.72, 457.32]
Content : Friday
Total 1 duplicate MCID(s) found
===============================================================================
You can download the pre-built jar
from the Releases page if you prefer not to build the tool yourself.
Before building the project, you need to download and install the PDFix SDK. This SDK is used to read and process PDF files for accessibility validation. Run the following commands:
mkdir -p lib
curl -L https://github.com/pdfix/pdfix_sdk_builds/releases/download/v8.4.3/java8-net.pdfix.pdfixlib-8.4.3.jar.zip -o lib/pdfixlib-8.4.3.jar.zip
unzip lib/pdfixlib-8.4.3.jar.zip -d lib/
mvn install:install-file -Dfile=lib/net.pdfix.pdfixlib-8.4.3.jar -DgroupId=net.pdfix -DartifactId=net.pdfix.pdfixlib -Dversion=8.4.3 -Dpackaging=jar
mvn compile
mvn test
mvn package
This project is licensed under the PDFix Free License.
If you have any questions or need assistance, feel free to reach out to us via email at support@pdfix.net.