Skip to content

Library

Romain Deltour edited this page Nov 9, 2020 · 10 revisions

Usage

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.w3c</groupId>
    <artifactId>epubcheck</artifactId>
    <version>4.2.4</version>
</dependency>

Apache Buildr

'org.w3c:epubcheck:jar:4.2.4'

Apache Ivy

<dependency org="org.w3c" name="epubcheck" rev="4.2.4" />

Gradle

compile group: 'org.w3c', name: 'epubcheck', version: '4.2.4'

Grails

compile 'org.w3c:epubcheck:4.2.4'

Scala SBT

libraryDependencies += "org.w3c" % "epubcheck" % "4.2.4"