psiegman / epublib

a java library for reading and writing epub files
http://www.siegmann.nl/epublib
1.04k stars 314 forks source link

Cannot parse the generated epub #130

Open zjamshidi opened 4 years ago

zjamshidi commented 4 years ago

I'm trying to generate an epub in my Android app and then show it using the FolioReader. Today I succeed to integrate the epublib library and generate my first epub. However, it could not be parsed by the reader!

FolioReader utilizes r2-streamer-kotlin to parse the epub file and it expects the opf file to have a package tag but in the genearted epub the contenet.opf tags has opf prefix. How can I remove the prefix?

zjamshidi commented 4 years ago

Here is my code

            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(new Resource(context.getAssets().open("book1/cover.jpg"), "cover.jpg" ));

            // Add Chapter 1
            book.addSection("Introduction",
                    new Resource( context.getAssets().open("book1/chapter1.html"), "chapter1.html" ));

            // Add css file
            book.getResources().add(
                    new Resource( context.getAssets().open("book1/styles.css"), "styles.css" ));

// Create EpubWriter
            EpubWriter epubWriter = new EpubWriter();
westernbuptboy commented 1 year ago

Hi. I encountered the same issue, did you solve it?