# epublib
Epublib is a java library for reading/writing/manipulating epub files.
It consists of 2 parts: a core that reads/writes epub and a collection of tools.
The tools contain an epub cleanup tool, a tool to create epubs from html files, a tool to create an epub from an uncompress html file.
It also contains a swing-based epub viewer.
![Epublib viewer](http://www.siegmann.nl/wp-content/uploads/Alice%E2%80%99s-Adventures-in-Wonderland_2011-01-30_18-17-30.png)
The core runs both on android and a standard java environment. The tools run only on a standard java environment.
This means that reading/writing epub files works on Android.
## Build status
* Travis Build Status: [![Build Status](https://travis-ci.org/psiegman/epublib.svg?branch=master)](https://travis-ci.org/psiegman/epublib)
## Command line examples
Set the author of an existing epub
java -jar epublib-3.0-SNAPSHOT.one-jar.jar --in input.epub --out result.epub --author Tester,Joe
Set the cover image of an existing epub
java -jar epublib-3.0-SNAPSHOT.one-jar.jar --in input.epub --out result.epub --cover-image my_cover.jpg
## Creating an epub programmatically
package nl.siegmann.epublib.examples;
import java.io.InputStream;
import java.io.FileOutputStream;
import nl.siegmann.epublib.domain.Author;
import nl.siegmann.epublib.domain.Book;
import nl.siegmann.epublib.domain.Metadata;
import nl.siegmann.epublib.domain.Resource;
import nl.siegmann.epublib.domain.TOCReference;
import nl.siegmann.epublib.epub.EpubWriter;
public class Translator {
private static InputStream getResource( String path ) {
return Translator.class.getResourceAsStream( path );
}
private static Resource getResource( String path, String href ) {
return new Resource( getResource( path ), href );
}
public static void main(String[] args) {
try {
// Create new Book
Book book = new Book();
Metadata metadata = book.getMetadata();
// Set the title
metadata.addTitle("Epublib test book 1");
// Add an Author
metadata.addAuthor(new Author("Joe", "Tester"));
// Set cover image
book.setCoverImage(
getResource("/book1/test_cover.png", "cover.png") );
// Add Chapter 1
book.addSection("Introduction",
getResource("/book1/chapter1.html", "chapter1.html") );
// Add css file
book.getResources().add(
getResource("/book1/book1.css", "book1.css") );
// Add Chapter 2
TOCReference chapter2 = book.addSection( "Second Chapter",
getResource("/book1/chapter2.html", "chapter2.html") );
// Add image used by Chapter 2
book.getResources().add(
getResource("/book1/flowers_320x240.jpg", "flowers.jpg"));
// Add Chapter2, Section 1
book.addSection(chapter2, "Chapter 2, section 1",
getResource("/book1/chapter2_1.html", "chapter2_1.html"));
// Add Chapter 3
book.addSection("Conclusion",
getResource("/book1/chapter3.html", "chapter3.html"));
// Create EpubWriter
EpubWriter epubWriter = new EpubWriter();
// Write the Book as Epub
epubWriter.write(book, new FileOutputStream("test1_book1.epub"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
## Usage in Android
Add the following lines to your `app` module's `build.gradle` file:
repositories {
maven {
url 'https://github.com/psiegman/mvn-repo/raw/master/releases'
}
}
dependencies {
implementation('nl.siegmann.epublib:epublib-core:4.0') {
exclude group: 'org.slf4j'
exclude group: 'xmlpull'
}
implementation 'org.slf4j:slf4j-android:1.7.25'
}
没有合适的资源?快使用搜索试试~ 我知道了~
最新epub转换器 最新epub转换器
共870个文件
class:213个
java:156个
htm:88个
需积分: 34 1 下载量 60 浏览量
2022-10-07
16:53:09
上传
评论
收藏 3.74MB RAR 举报
温馨提示
最新epub转换器 最新epub转换器
资源详情
资源评论
资源推荐
收起资源包目录
最新epub转换器 最新epub转换器 (870个子文件)
#IDXHDR 4KB
#IDXHDR 4KB
#IDXHDR 4KB
#IDXHDR 4KB
#IVB 44B
#IVB 44B
#IVB 44B
#IVB 44B
#STRINGS 937B
#STRINGS 937B
#STRINGS 937B
#STRINGS 937B
#SYSTEM 4KB
#SYSTEM 4KB
#SYSTEM 4KB
#SYSTEM 4KB
#TOPICS 448B
#TOPICS 448B
#TOPICS 448B
#TOPICS 448B
#URLSTR 1KB
#URLSTR 1KB
#URLSTR 1KB
#URLSTR 1KB
#URLTBL 336B
#URLTBL 336B
#URLTBL 336B
#URLTBL 336B
#WINDOWS 400B
#WINDOWS 400B
#WINDOWS 400B
#WINDOWS 400B
$FIftiMain 23KB
$FIftiMain 23KB
$FIftiMain 23KB
$FIftiMain 23KB
$OBJINST 3KB
$OBJINST 3KB
$OBJINST 3KB
$OBJINST 3KB
xhtml-symbol.ent.1 14KB
xhtml-symbol.ent.1 14KB
xhtml-datatypes-1.mod.1 3KB
xhtml-datatypes-1.mod.1 3KB
BTree 6KB
BTree 6KB
BTree 6KB
BTree 6KB
BTree 2KB
BTree 2KB
BTree 2KB
BTree 2KB
Relator.class 22KB
PackageDocumentReader.class 13KB
NCXDocument.class 13KB
XmlStreamReader.class 11KB
ContentPane.class 11KB
Viewer.class 10KB
Inflater.class 9KB
PackageDocumentMetadataReader.class 8KB
Resources.class 8KB
CoverpageBookProcessor.class 8KB
DeflaterEngine.class 8KB
PackageDocumentWriter.class 8KB
Fileset2Epub.class 8KB
ZipFile.class 8KB
Metadata.class 7KB
SearchIndex.class 7KB
HTMLDocumentFactory.class 7KB
TableOfContents.class 7KB
StringUtilTest.class 7KB
HtmlSplitter.class 7KB
EpubReader.class 7KB
EpubWriter.class 7KB
Book.class 7KB
HtmlCleanerBookProcessorTest.class 7KB
TableOfContentsPane.class 7KB
PackageDocumentMetadataWriter.class 6KB
ZipOutputStream.class 6KB
MetadataPane.class 6KB
DeflaterHuffman$Tree.class 6KB
ZipInputStream.class 6KB
FilesetBookCreator.class 6KB
Navigator.class 6KB
ImageLoaderCache.class 6KB
ChmParser.class 6KB
ZipEntry.class 6KB
EpubWriterTest.class 6KB
NavigationBar.class 6KB
DeflaterHuffman.class 5KB
ResourcesLoaderTest.class 5KB
HHCParser.class 5KB
SearchIndexTest.class 5KB
PackageDocumentReaderTest.class 5KB
Deflater.class 5KB
MyHtmlEditorKit.class 5KB
StreamWriterDelegate.class 5KB
PackageDocumentMetadataReaderTest.class 5KB
BOMInputStream.class 5KB
ResourcesLoader.class 5KB
共 870 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
Arenaschi
- 粉丝: 789
- 资源: 72
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0