Reputation: 79
i have 2 folders(meta-inf,oebpf) and 1 file(mimetype) i wish to convert it to epub format. I am using java.util.zip.ZipEntry, java.util.zip.ZipOutputStream to compress to .epub but i am unable to read the files. But whin i compress it using 7zip and rename it i can use it.
my mimetype file only contains "application/epub+zip". but in wiki it says to add some more text http://en.wikipedia.org/wiki/EPub#Open_Container_Format_2.0.1
is there a jar file for compressing to epub? or else is there something i should do.
Upvotes: 3
Views: 608
Reputation: 43083
You can try this library : https://github.com/psiegman/epublib
It is specially designed for manipulating epub files.
Sample code :
// Create new Book
Book book = new Book();
// In metadata, set the title and author
Metadata metadata = book.getMetadata();
metadata.addTitle("Epublib test book 1");
metadata.addAuthor(new Author("Joe", "Tester"));
// Add chapter 1
book.addSection(
"Chapter 1", //
getResource("/book1/chapter1.html", "chapter1.html") //
);
// Add chapter N
// ...
// Write the Book as Epub
EpubWriter epubWriter = new EpubWriter();
epubWriter.write(book, new FileOutputStream("my_first_book1.epub"));
Source : Creating an ebook programmatically
Upvotes: 1