No description
Paul Campbell
3a0af42f39
* Add GitHub Actions for CI * Remove unused CI and release files * Ignore IntelliJ files * pom: add my parent * pom: remove redundant packaging element * pom: update scm repo * pom: upgrade to Java 1.8 * pom: remove maven-release-plugin * pom: remove opencollab distributionManagement * pom: remove releases profile * pom: add kemitix-maven-tiles: maven-plugins, enforcer, compiler-jdk-8, testing * Update readme * Version set to 1.0.2 * github: test build with JDK 8 * github: remove native-image testing * pom: update groupId |
||
---|---|---|
.github | ||
src | ||
.gitattribute | ||
.gitignore | ||
LICENSE | ||
pom.xml | ||
README.md |
epub-creator
Java EPUB3 creator API
Create EPUB3 standard ebooks.
Features
- Build valid EPUB3 (Validator)
- Add files or text as content
- Set TOC inclusion
- Set spine inclusion
- Add text as content/pages
Build instructions
You will need
- Java 8+
- Maven 3+
mvn clean install
Code example
try (FileOutputStream file = new FileOutputStream(new File("test.epub"))) {
EpubBook book = new EpubBook("en", "Samuel .-__Id1", "Test Book", "Samuel Holtzkampf");
book.addContent(this.getClass().getResourceAsStream("/epub30-overview.xhtml"),
"application/xhtml+xml", "xhtml/epub30-overview.xhtml", true, true).setId("Overview");
book.addContent(this.getClass().getResourceAsStream("/idpflogo_web_125.jpg"),
"image/jpeg", "img/idpflogo_web_125.jpg", false, false);
book.addContent(this.getClass().getResourceAsStream("/epub-spec.css"),
"text/css", "css/epub-spec.css", false, false);
book.addTextContent("TestHtml", "xhtml/test2.xhtml", "Test one two four!!!!!\nTesting two").setToc(true);
book.addTextContent("TestHtml", "xhtml/test.xhtml", "Test one two three\nTesting two").setToc(true);
book.addCoverImage(IOUtils.toByteArray(this.getClass().getResourceAsStream("/P1010832.jpg")),
"image/jpeg", "images/P1010832.jpg");
book.writeToStream(file);
}