Hi all,
I have created epub using epublib-core-3.1.jar. I am able to create epubs and view on brower. But when i tried to open these epubs in android or iphones than it is not opening showing error document not available. Please help me. I used sample code also i.e.
/**
*
*/
package sample;
import java.io.FileOutputStream;
import nl.siegmann.epublib.domain.Author;
import nl.siegmann.epublib.domain.Book;
import nl.siegmann.epublib.domain.Resource;
import nl.siegmann.epublib.domain.TOCReference;
import nl.siegmann.epublib.epub.EpubWriter;
/**
* @author HP
*
*/
public class Trans1 {
public static void main(String[] args) {
try {
// Create new Book
Book book = new Book();
// Set the title
book.getMetadata().addTitle("Epublib test book 1");
// Add an Author
book.getMetadata().addAuthor(new Author("Joe", "Tester"));
// Add Chapter 1
book.addSection("Introduction", new Resource(Trans1.class.getResourceAsStream("/resources/chapter1.html"), "chapter1.html"));
// Add css file
book.getResources().add(new Resource(Trans1.class.getResourceAsStream("/resources/book1.css"), "book1.css"));
// Add Chapter 2
TOCReference chapter2 = book.addSection("Second Chapter", new Resource(Trans1.class.getResourceAsStream("/resources/chapter2.html"), "chapter2.html"));
// Add Chapter 3
book.addSection("Conclusion", new Resource(Trans1.class.getResourceAsStream("/resources/chapter3.html"), "chapter3.html"));
// Create EpubWriter
EpubWriter epubWriter = new EpubWriter();
// Write the Book as Epub
epubWriter.write(book, new FileOutputStream("C:\\Users\\HP\\Desktop\\test1_book1.epub"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
But still not working for devices. Please help me