Use as a Java Library
You can use EPUBCheck as a library in your Java application. EPUBCheck public interfaces can be found in the com.adobe.epubcheck.api
package. The EPUBCheck
class can be used to instantiate a validation engine. Use one of its constructors and then call validate()
method.
Basic example (snippet):
File epubFile = new File("/path/to/your/epub/file.epub");
// simple constructor; errors are printed on stderr stream
EPUBCheck epubcheck = new EPUBCheck(epubFile);
// validate() returns true if no errors or warnings are found
boolean result = epubcheck.validate();
Report
is an interface that you can implement to get a list of the errors and warnings reported by the validation engine (instead of the error list being printed out on stderr
). See also how to customize the validation report.
The default ZIP distribution contains all you need to use EPUBCheck as a library.
§ Dependency Information
EPUBCheck jar
releases are available in the Maven Central Repository.
To use it as a library in your project, use the dependency information matching your build tool
§ Apache Maven
<dependency>
<groupId>org.idpf</groupId>
<artifactId>epubcheck</artifactId>
<version>4.1.0</version>
</dependency>
§ Apache Buildr
'org.idpf:epubcheck:jar:4.1.0'
§ Apache Ivy
<dependency org="org.idpf" name="epubcheck" rev="4.1.0" />
§ Gradle
compile group: 'org.idpf', name: 'epubcheck', version: '4.1.0'
§ Grails
compile 'org.idpf:epubcheck:4.1.0'
§ Scala SBT
libraryDependencies += "org.idpf" % "epubcheck" % "4.1.0"