当前位置: 首页 > 工具软件 > EpubCheck > 使用案例 >

epubcheck用法(转)

利俊迈
2023-12-01

Running

Tobias Fischer edited this page on 2 Sep · 8 revisions

EpubCheck is a command line tool, all detected errors are simply printed to stderr output stream.

There's no native GUI – however, there are some thirdparty apps offering a GUI. See theGUI wiki page for further details.

System prerequisites

To run the tool you need Java (1.6 or above, 1.7+ recommended). Any Operating System should do.

Note on Java:

You need at least JRE or JDK 1.6 to run EpubCheck on the commandline. However, starting with EpubCheck 4.0 werecommend Java 1.7 or 1.8 to be able to run advanced image checks (Java 1.6 doesn't support those).

Note on Java on Mac OS X:

Due to the change in ownership of the Apple Java version from Apple to Oracle, Java 1.6 (Apple) and Java 1.7+ (Oracle) are kind of incompatible to each other. To run EpubCheck with advanced image checks in a Mac OS X Terminal, theOracle JDK 1.7+ is required!

Running from the command line

Validating a packaged EPUB

java -jar epubcheck.jar file.epub

Specifying a validation profile

It is possible to specify a validation profile to validate an EPUB (or single file thereof) against a specific IDPF specification.

java -jar epubcheck.jar file.epub -profile PROFILE

Current profiles include:

Note: In most cases, it is not required to specify the validation profile explicitly, as it will automatically be set according todc:type metadata in the Publication. Setting the profile explicitly can be useful to detect when suchdc:type metadata is missing, or to validate single files (see next section).

Validating a single file

java -jar epubcheck.jar singleFile -mode MODE -v VERSION -profile PROFILE
  • MODE must be one of the following:

    • opf for package document validation;
    • nav for navigation document validation (available only for version 3.0);
    • mo for media overlay validation (available only for version 3.0);
    • xhtml;
    • svg;
    • exp for Expanded EPUB validation (see the next section)
  • VERSION must be one of

    • 2.0
    • 3.0
  • PROFILE is optional (see the previous section).

Note that when validating a single file, only a subset of the available tests is run. Also, when validating a full EPUB, both mode and version are ignored.

Validating an "expanded" (i.e. unzipped) EPUB

java -jar epubcheck.jar folder/ -mode exp [-save]

When using expanded mode, there's an optional flag -save to save the created archive upon validation.

Additional flags

  • -out file.xml outputs an assessment XML document
  • -quiet or -q outputs only if there is any warning or error
  • -help, --help or -? displays a help message

转自:https://github.com/IDPF/epubcheck/wiki/Running

epubcheck项目地址:https://github.com/IDPF/epubcheck

 类似资料: