psiegman / epublib Goto Github PK
View Code? Open in Web Editor NEWa java library for reading and writing epub files
Home Page: http://www.siegmann.nl/epublib
a java library for reading and writing epub files
Home Page: http://www.siegmann.nl/epublib
Currently there's no way in epublib to read additional properties like the ones defined in EPUB 3 Fixed-Layout Documents
The getOtherProperties()
method seems to return always null. Wouldn't it be usefull to have a way to access all properties of metadata somehow?
within content.opf file,
media-overlay property of the tag disappear after a read/write on the same book.
Expectation:
media-overlay property should remain.
I'm trying to build epublib on a Windows box, and I get the following error:
Running nl.siegmann.epublib.util.StringUtilTest
Tests run: 14, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.021 sec <<< FAILURE!
Results :
Failed tests: testReplacementForCollapsePathDots(nl.siegmann.epublib.util.StringUtilTest): expected:<[/foo/]bar.html> but was:<[\foo\]bar.html>
Tests run: 45, Failures: 1, Errors: 0, Skipped: 0
Looking at the test, it seems like FilenameUtils.normalize converts the filename separator to the local value, so "/foo/bar.html" normalizes to "\foo\bar.html".
My app crashes on this line:
Book book = epubReader.readEpub(new FileInputStream(file));
where file = /storage/emulated/0/Download/burnett-secret-garden-illustrations.epub
There error was:
03-13 16:29:55.046: E/AndroidRuntime(17721): FATAL EXCEPTION: main
I'm not sure Maven can work without getting a directory listing. Does anyone here have Maven support for the library correctly working with their build process?
Thanks
Greg
Hi i am new to Android,I am creating a epub reader using Paul Siegmann epublib. I succeeded in reading the text and images of Epub book. Now i have to read Audio and Video files from epub book. Can any one give me any suggestions .....
We need to add an encoding to the IpInputStream in EpubReader.java/.class
import java.nio.charset.Charset;
...
new ZipInputStream(in, Charset.forName("UTF-8")
I get these fatal errors on my console:
[Fatal Error] :1:2: Markup im Dokument vor dem Root-Element muss ordnungsgemäß formatiert sein.
[Fatal Error] :18:49: Präfix "opf" für Attribut "opf:scheme", das mit Elementtyp "dc:identifier" verknüpft ist, ist nicht gebunden.
How to catch these exceptions and solve them?
Where do they come from?
Seems this comes from XMLPull.
But what API/version do we need from XMLPull?
Are there more dependencies?
What is with org.w3c.dom?
Hi. i am using epub lib for reading epub file(2.0 and 3.0).. There was an image problem, i have modified ImageLoaderCache class. The image was displaying now.
I have an another problem is CSS not applying when read and display the epub file in java swing.. Please let me know the idea for avoiding this style sheet problem..
Thanks,
Velmurugan T
cannot access javax.xml.stream.XMLStreamException
class file for javax.xml.stream.XMLStreamException not found epubWriter.write(book, new FileOutputStream("books/testbook.epub"));
Is there something I am doing wrong?
I looked in the Android jar with no luck.
Android 2.2 / 2.3 / 3.0 no luck.
Thank you for the library, Paul.
OPF and NCX files are hardcoded on output as OEPBS/content.opf and OEPBS/toc.ncx accordingly. This leads to the case when an epub with different location and/or names of the files is loaded and then saved, the internal structure of the new epub will differ from the original. The new file is valid. Problem occurs when one makes an assumption about internal structure of the new epub based on the structure of the original, e.g. file names are different and all content may be moved into OEPBS/OEPBS directory if OPF of the original is in root directory and the content is in OEPBS.
Stacktrace:
ERROR nl.siegmann.epublib.epub.EpubWriter - Error writing table of contents: java.lang.NullPointerException: null
ERROR nl.siegmann.epublib.epub.EpubProcessorSupport - When creating XmlSerializer: org.xmlpull.v1.XmlPullParserException: No valid serializer classes found in resource /META-INF/services/org.xmlpull.v1.XmlPullParserFactory that contained 'org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer'
org.xmlpull.v1.XmlPullParserException: No valid serializer classes found in resource /META-INF/services/org.xmlpull.v1.XmlPullParserFactory that contained 'org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer'
at org.xmlpull.v1.XmlPullParserFactory.newSerializer(XmlPullParserFactory.java:223)
at nl.siegmann.epublib.epub.EpubProcessorSupport.createXmlSerializer(EpubProcessorSupport.java:81)
at nl.siegmann.epublib.epub.EpubProcessorSupport.createXmlSerializer(EpubProcessorSupport.java:73)
at nl.siegmann.epublib.epub.EpubWriter.writePackageDocument(EpubWriter.java:111)
at nl.siegmann.epublib.epub.EpubWriter.write(EpubWriter.java:53)
Hello,
trying to read an epub, whose fb.ncx resource has the following dtd:
The defined EntityResolver tries to use an internal resource instead of the remote url, which is good, but the given dtd from daisy.org is not cached. I don't know the epub conventions, what is compulsory and what not, but I suppose that dtd should be cached too.
The Epub is The Man Who Was Thursday: a Nightmare, by Chesterton, Gilbert Keith from feedbooks.
Regards;
Petru
According to [1] there should be a Maven repository at https://github.com/psiegman/mvn-repo/raw/master/releases but GitHub gives me a 404. What is the correct URL? Are the artifacts in the repository up to date?
Update: It works, this just a GitHub "problem", there is just no dicrectory listing. The question if the repository is up to date remains.
價值投資先生的世界
the getTitle() function can only parse the 1st chinese character (價)
i am new to android webview , how could i catch the flash play event,and make it play fully screen
Hi Paul, great work.
I'm writing a viewer for epub with your library but I don't know how show image of epub. I tried to make a subclass WebViewClient and overloading method onLoadResource but it's not working... Ca you explain me? Is there anyone example source?
Thanks in advance
There is a performance issue when creating large epubs that have a lot of files. The issue is in nl.siegmann.epublib.domain.Resources.java, in the methods createUniqueResourceId and fixResourceHref. When a large number of resources are added that don't have ids or hrefs set, each additional added resource will result in the next one taking more time to add. This is because the counters in the two methods always start from 1, and then try to find the first valid href or id. These counters should be member variables so that they do not always start from the beginning but from the last valid href or id found.
I have a very large epub that I was generating that had about 10000 xhtml files, and it was taking hours to add the files to the book (over 3 hours before I quit, and it was only 75% done - each additional file would have taken more and more time). Managing the resources directly in my code cut this down to less than a minute.
Thanks.
Hi,
i test the viewer with a comic book in .epub format and found that the viewer failed after sometime.
memory usage keep increasing while changing chapters(1picture in 1chapter/1html file, total 200+ images). Then i digging into the source and found that the ImageLoaderCache class doesn't clear the hashmap during switching the html document.
I'm not sure if this belongs to here as this seems have nothing to do with the core. Thank you.
Hi,
I want to make epub reader for J2ME but i just want to know if it will have the similar effect as in android?WIll there be any issue? Can we implement pagination as well?
Thanks,
Reetika Mittal
Logging implementations must be optional in the pom. Otherwise anyone who pulls in this jar (me) will lose all logging with slf4j-simple's no-op implementation. Please remove that dependency from the pom.
01-15 11:04:25.224: E/AndroidRuntime(634): FATAL EXCEPTION: main
01-15 11:04:25.224: E/AndroidRuntime(634): java.lang.OutOfMemoryError
01-15 11:04:25.224: E/AndroidRuntime(634): at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:122)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.util.IOUtil.toByteArray(IOUtil.java:45)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.domain.Resource.(Resource.java:114)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.util.ResourceUtil.createResource(ResourceUtil.java:64)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readResources(EpubReader.java:188)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:94)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:53)
01-15 11:04:25.224: E/AndroidRuntime(634): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:37)
01-15 11:04:25.224: E/AndroidRuntime(634): at epub.reader.EpubReader.onCreate(EpubReader.java:34)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.Activity.performCreate(Activity.java:5008)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.os.Handler.dispatchMessage(Handler.java:99)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.os.Looper.loop(Looper.java:137)
01-15 11:04:25.224: E/AndroidRuntime(634): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-15 11:04:25.224: E/AndroidRuntime(634): at java.lang.reflect.Method.invokeNative(Native Method)
01-15 11:04:25.224: E/AndroidRuntime(634): at java.lang.reflect.Method.invoke(Method.java:511)
01-15 11:04:25.224: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-15 11:04:25.224: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-15 11:04:25.224: E/AndroidRuntime(634): at dalvik.system.NativeStart.main(Native Method)
My code is just:
WebView webview = (WebView) findViewById(R.id.webView1);
try {
InputStream inputFile = getAssets().open("linear_algebra.epub");
nl.siegmann.epublib.epub.EpubReader reader = new nl.siegmann.epublib.epub.EpubReader();
Book book = reader.readEpub(inputFile);
Log.i("epublib", "title: " + book.getTitle());
String data = new String(book.getContents().get(2).getData());
webview.loadData(data," text/html", "utf8");
} catch (IOException e1) {
e1.printStackTrace();
}
i need to support <html...... dir="rtl">
I want to extend the Book class of Epublib like this..
public class MyBook extends Book {
protected String Extranfo;
}
but, I am classcast exception while typecasting.
book = (MyBook ) epubReader.readEpubLazy(bookPath, "UTF-8",
Arrays.asList(lazyTypes));
The exception is
java.lang.ClassCastException: nl.siegmann.epublib.domain.Book cannot be cast to bookshelf.src.MyBook
Please suggest how to get rid of this.
Dear Siegman
Hope you are doing fine. Long back I have started using your library for eReader implementation. I had put that work on hold for sometime and back in action with full swing.
Here is a challenge that I am facing:
I am unzipping entire ePUB and then using WebView of android to pass the required HTML content. This is working fine.
But if the file size is pretty huge then readyLazy method is taking lot of time for a 20 MB or more file sized ePUB. I need your library, to keep track of resources (esp HTMLs). I tried looking at the library but couldn't find any direct way to do this, I am sure, I am missing something pretty obivious.
Can you please help or point to a method that would help me in keeping track of resources esp Table of conntents. Idea being, I should know the list of HTMLs that are present in the ePUB and ability to read the content with in it.
Pointer from your end would be of immense help.
Thanks
Susheel Zaveri
Since the Maven repository is broken (see next issue) it might be better to add artifacts to central. This way they are also discovered by several Maven search engines.
Just to give you a background, we are building a ePUB Reader for Android platform.
In this context, I would like to know as to how we can read this page break information via ePUB lib. We are implementing page break using CSS. Should I write a layer between ePublib and passing information to WebView on Android ?
Also is it advisable to have a WebView in Android for eReader or build a different layout. My idea to implement entire iBook functionality (where in the page numbers are calculated dynamically).
Also a favor, if possible, in WebView I am not able to capture the touch events and selection events as required for implementing text high light feature (similar to iBook) any help on this would be a great relief to my Soul :)
Thanks
Susheel Zaveri
Hi there,
I'm developing an epub app (I guess everyone with an issue is). I am able to retrieve the text and display it in a webview and am also able to retrieve the table of contents and the cover page. The current problem I'm facing is the application of the CSS (stylesheets) of the respective ePub file.
I've read around that it would require unzipping the CSS file onto the device and then reading it from there. In the current app I'm developing, I've placed the epub file in the 'assets' folder.
Some things I would like to know:
Thanks for your time.
here is my code
package com.example.almawred;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import nl.siegmann.epublib.domain.Book;
import nl.siegmann.epublib.domain.TOCReference;
import nl.siegmann.epublib.epub.EpubReader;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AssetManager assetManager = getAssets();
try {
// find InputStream for book
InputStream epubInputStream = assetManager.open("georgia-cfi-20120521.epub");
// Load Book from inputStream
Book book = (new EpubReader()).readEpub(epubInputStream);
// Log the book's authors
Log.i("epublib", "author(s): " + book.getMetadata().getAuthors());
// Log the book's title
Log.i("epublib", "title: " + book.getTitle());
// Log the book's coverimage property
Bitmap coverImage = BitmapFactory.decodeStream(book.getCoverImage()
.getInputStream());
Log.i("epublib", "Coverimage is " + coverImage.getWidth() + " by "
+ coverImage.getHeight() + " pixels");
// Log the tale of contents
logTableOfContents(book.getTableOfContents().getTocReferences(), 0);
} catch (IOException e) {
Log.e("epublib", e.getMessage());
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private void logTableOfContents(List<TOCReference> tocReferences, int depth) {
if (tocReferences == null) {
return;
}
for (TOCReference tocReference : tocReferences) {
StringBuilder tocString = new StringBuilder();
for (int i = 0; i < depth; i++) {
tocString.append("\t");
}
tocString.append(tocReference.getTitle());
Log.i("epublib", tocString.toString());
logTableOfContents(tocReference.getChildren(), depth + 1);
}
}
}
and i get this LogCat error ??
04-01 20:26:41.019: E/epublib(410): georgia-cfi-20120521.epub
04-01 20:30:30.198: E/epublib(439): georgia-cfi-20120521.epub
04-01 20:34:12.268: E/AndroidRuntime(471): FATAL EXCEPTION: main
04-01 20:34:12.268: E/AndroidRuntime(471): java.lang.ExceptionInInitializerError
04-01 20:34:12.268: E/AndroidRuntime(471): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:32)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.os.Looper.loop(Looper.java:126)
04-01 20:34:12.268: E/AndroidRuntime(471): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 20:34:12.268: E/AndroidRuntime(471): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 20:34:12.268: E/AndroidRuntime(471): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 20:34:12.268: E/AndroidRuntime(471): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 20:34:12.268: E/AndroidRuntime(471): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 20:34:12.268: E/AndroidRuntime(471): at dalvik.system.NativeStart.main(Native Method)
04-01 20:34:12.268: E/AndroidRuntime(471): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 20:34:12.268: E/AndroidRuntime(471): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 20:34:12.268: E/AndroidRuntime(471): ... 14 more
04-01 20:53:11.058: E/AndroidRuntime(500): FATAL EXCEPTION: main
04-01 20:53:11.058: E/AndroidRuntime(500): java.lang.ExceptionInInitializerError
04-01 20:53:11.058: E/AndroidRuntime(500): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:32)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.os.Looper.loop(Looper.java:126)
04-01 20:53:11.058: E/AndroidRuntime(500): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 20:53:11.058: E/AndroidRuntime(500): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 20:53:11.058: E/AndroidRuntime(500): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 20:53:11.058: E/AndroidRuntime(500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 20:53:11.058: E/AndroidRuntime(500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 20:53:11.058: E/AndroidRuntime(500): at dalvik.system.NativeStart.main(Native Method)
04-01 20:53:11.058: E/AndroidRuntime(500): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 20:53:11.058: E/AndroidRuntime(500): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 20:53:11.058: E/AndroidRuntime(500): ... 14 more
04-01 21:11:06.929: E/AndroidRuntime(538): FATAL EXCEPTION: main
04-01 21:11:06.929: E/AndroidRuntime(538): java.lang.ExceptionInInitializerError
04-01 21:11:06.929: E/AndroidRuntime(538): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:34)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.os.Looper.loop(Looper.java:126)
04-01 21:11:06.929: E/AndroidRuntime(538): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 21:11:06.929: E/AndroidRuntime(538): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 21:11:06.929: E/AndroidRuntime(538): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 21:11:06.929: E/AndroidRuntime(538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 21:11:06.929: E/AndroidRuntime(538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 21:11:06.929: E/AndroidRuntime(538): at dalvik.system.NativeStart.main(Native Method)
04-01 21:11:06.929: E/AndroidRuntime(538): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 21:11:06.929: E/AndroidRuntime(538): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 21:11:06.929: E/AndroidRuntime(538): ... 14 more
04-01 21:16:25.969: E/AndroidRuntime(572): FATAL EXCEPTION: main
04-01 21:16:25.969: E/AndroidRuntime(572): java.lang.ExceptionInInitializerError
04-01 21:16:25.969: E/AndroidRuntime(572): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:34)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.os.Looper.loop(Looper.java:126)
04-01 21:16:25.969: E/AndroidRuntime(572): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 21:16:25.969: E/AndroidRuntime(572): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 21:16:25.969: E/AndroidRuntime(572): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 21:16:25.969: E/AndroidRuntime(572): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 21:16:25.969: E/AndroidRuntime(572): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 21:16:25.969: E/AndroidRuntime(572): at dalvik.system.NativeStart.main(Native Method)
04-01 21:16:25.969: E/AndroidRuntime(572): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 21:16:25.969: E/AndroidRuntime(572): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 21:16:25.969: E/AndroidRuntime(572): ... 14 more
04-01 21:17:14.818: E/AndroidRuntime(602): FATAL EXCEPTION: main
04-01 21:17:14.818: E/AndroidRuntime(602): java.lang.ExceptionInInitializerError
04-01 21:17:14.818: E/AndroidRuntime(602): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:34)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.os.Looper.loop(Looper.java:126)
04-01 21:17:14.818: E/AndroidRuntime(602): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 21:17:14.818: E/AndroidRuntime(602): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 21:17:14.818: E/AndroidRuntime(602): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 21:17:14.818: E/AndroidRuntime(602): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 21:17:14.818: E/AndroidRuntime(602): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 21:17:14.818: E/AndroidRuntime(602): at dalvik.system.NativeStart.main(Native Method)
04-01 21:17:14.818: E/AndroidRuntime(602): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 21:17:14.818: E/AndroidRuntime(602): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 21:17:14.818: E/AndroidRuntime(602): ... 14 more
04-01 21:46:39.309: E/AndroidRuntime(649): FATAL EXCEPTION: main
04-01 21:46:39.309: E/AndroidRuntime(649): java.lang.ExceptionInInitializerError
04-01 21:46:39.309: E/AndroidRuntime(649): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:32)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.os.Looper.loop(Looper.java:126)
04-01 21:46:39.309: E/AndroidRuntime(649): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 21:46:39.309: E/AndroidRuntime(649): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 21:46:39.309: E/AndroidRuntime(649): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 21:46:39.309: E/AndroidRuntime(649): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 21:46:39.309: E/AndroidRuntime(649): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 21:46:39.309: E/AndroidRuntime(649): at dalvik.system.NativeStart.main(Native Method)
04-01 21:46:39.309: E/AndroidRuntime(649): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 21:46:39.309: E/AndroidRuntime(649): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 21:46:39.309: E/AndroidRuntime(649): ... 14 more
04-01 21:50:10.030: E/AndroidRuntime(684): FATAL EXCEPTION: main
04-01 21:50:10.030: E/AndroidRuntime(684): java.lang.ExceptionInInitializerError
04-01 21:50:10.030: E/AndroidRuntime(684): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:32)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.os.Looper.loop(Looper.java:126)
04-01 21:50:10.030: E/AndroidRuntime(684): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 21:50:10.030: E/AndroidRuntime(684): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 21:50:10.030: E/AndroidRuntime(684): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 21:50:10.030: E/AndroidRuntime(684): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 21:50:10.030: E/AndroidRuntime(684): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 21:50:10.030: E/AndroidRuntime(684): at dalvik.system.NativeStart.main(Native Method)
04-01 21:50:10.030: E/AndroidRuntime(684): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 21:50:10.030: E/AndroidRuntime(684): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 21:50:10.030: E/AndroidRuntime(684): ... 14 more
04-01 21:51:15.119: E/AndroidRuntime(718): FATAL EXCEPTION: main
04-01 21:51:15.119: E/AndroidRuntime(718): java.lang.ExceptionInInitializerError
04-01 21:51:15.119: E/AndroidRuntime(718): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:32)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.os.Looper.loop(Looper.java:126)
04-01 21:51:15.119: E/AndroidRuntime(718): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 21:51:15.119: E/AndroidRuntime(718): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 21:51:15.119: E/AndroidRuntime(718): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 21:51:15.119: E/AndroidRuntime(718): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 21:51:15.119: E/AndroidRuntime(718): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 21:51:15.119: E/AndroidRuntime(718): at dalvik.system.NativeStart.main(Native Method)
04-01 21:51:15.119: E/AndroidRuntime(718): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 21:51:15.119: E/AndroidRuntime(718): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 21:51:15.119: E/AndroidRuntime(718): ... 14 more
04-01 22:05:34.819: E/AndroidRuntime(752): FATAL EXCEPTION: main
04-01 22:05:34.819: E/AndroidRuntime(752): java.lang.ExceptionInInitializerError
04-01 22:05:34.819: E/AndroidRuntime(752): at com.example.almawredver2.MainActivity.onCreate(MainActivity.java:32)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.os.Looper.loop(Looper.java:126)
04-01 22:05:34.819: E/AndroidRuntime(752): at android.app.ActivityThread.main(ActivityThread.java:3997)
04-01 22:05:34.819: E/AndroidRuntime(752): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 22:05:34.819: E/AndroidRuntime(752): at java.lang.reflect.Method.invoke(Method.java:491)
04-01 22:05:34.819: E/AndroidRuntime(752): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-01 22:05:34.819: E/AndroidRuntime(752): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-01 22:05:34.819: E/AndroidRuntime(752): at dalvik.system.NativeStart.main(Native Method)
04-01 22:05:34.819: E/AndroidRuntime(752): Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
04-01 22:05:34.819: E/AndroidRuntime(752): at nl.siegmann.epublib.epub.EpubReader.(EpubReader.java:33)
04-01 22:05:34.819: E/AndroidRuntime(752): ... 14 more
I am not able to implement the reflowable text function.
can you please let me know the way to do it.
Thanks and Regards
Hi,
I have successfully shown the contents of the .epub format book but when i am showing them in a webview the hyperlinks are not working(not opening the corresponding page).
Thanks,
Ritika
When export to epub file can I set the version of format? Thanks.
With sample container.xml
<ns0:container version="1.0">
<ns0:rootfiles>
<ns0:rootfile media-type="application/oebps-package+xml" full-path="25716/content.opf"/>
</ns0:rootfiles>
</ns0:container>
library throws NPE
Methods Resources.getResourcesByMediaType and Resources.getResourcesByMediaTypes compare types by pointer while, IMO, it should be by value i.e.
if (resource.getMediaType() == mediaType) { //current
if (resource.getMediaType().equals(mediaType)) { //expected
IMO, even more useful would be passing the type as string e.g.
public List getResourcesByMediaType(String mediaType)
Can not download the jar
http://cloud.github.com/downloads/psiegman/epublib/epublib-core-latest.jar
I am encountering an error with
line# 296 in LibraryFragment.java //spanner.unregisterHandler("img" ); //We don't want to render images
and
line88 in TextLoader.java // MediatypeService.OGG,
Hi Paul,
I tried to create my own ebook from an existing ebook, by modifying stlightly the content to change some text, etc. Now when I try to create it (by doing epubWriter.write(book, new FileOutputStream(file));) I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserFactory
So I tried to add manually a jar for this, com.springsource.org.xmlpull-1.1.4.jar that I found after 30mins of search for a library that would contain the missing classes, but now get this error:
[ERROR] nl.siegmann.epublib.epub.EpubProcessorSupport - When creating XmlSerializer: org.xmlpull.v1.XmlPullParserException: caused by: org.xmlpull.v1.XmlPullParserException: resource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory make sure that parser implementing XmlPull API is available
Where could I get this library? thanks
The href given to a Resource in its constructor is output into the opf as-is but should be uri encoded.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: in is null
at java.util.zip.ZipInputStream.(Unknown Source)
at java.util.zip.ZipInputStream.(Unknown Source)
at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:59)
at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:39)
at nl.siegmann.epublib.viewer.Viewer.(Viewer.java:57)
at nl.siegmann.epublib.viewer.Viewer$9.run(Viewer.java:338)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
12484 [AWT-EventQueue-0] ERROR nl.siegmann.epublib.epub.PackageDocumentReader - Cover resource cover not found
12500 [AWT-EventQueue-0] ERROR nl.siegmann.epublib.epub.NCXDocument - remote resource is not cached : [http://www.daisy.org/z3986/2005/ncx-2005-1.dtd] cannot continue
java.lang.RuntimeException: remote resource is not cached : [http://www.daisy.org/z3986/2005/ncx-2005-1.dtd] cannot continue
at nl.siegmann.epublib.epub.EpubProcessorSupport$EntityResolverImpl.resolveEntity(EpubProcessorSupport.java:57)
at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at nl.siegmann.epublib.util.ResourceUtil.getAsDocument(ResourceUtil.java:123)
at nl.siegmann.epublib.util.ResourceUtil.getAsDocument(ResourceUtil.java:103)
at nl.siegmann.epublib.epub.NCXDocument.read(NCXDocument.java:90)
at nl.siegmann.epublib.epub.EpubReader.processNcxResource(EpubReader.java:126)
at nl.siegmann.epublib.epub.EpubReader.readEpubResources(EpubReader.java:112)
at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:99)
at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:59)
at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:39)
at nl.siegmann.epublib.viewer.Viewer$1.actionPerformed(Viewer.java:161)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Hi Paul,
It would be great to have tagged release versions of epuplib rather than just using the SNAPSHOT.
Luke
http://www.siegmann.nl/epublib/apidocs
I am always redirected to this pag
I tried to read several epub books, and in most cases it worked, but reading the RobinsonCrusoe.epub failed, below the stacktrace:
java.lang.RuntimeException: remote resource is not cached : [http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd] cannot continue at nl.siegmann.epublib.epub.EpubProcessor$1.resolveEntity(EpubProcessor.java:49) at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:107) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:1018) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) at nl.siegmann.epublib.util.ResourceUtil.getAsDocument(ResourceUtil.java:192) at nl.siegmann.epublib.util.ResourceUtil.getAsDocument(ResourceUtil.java:172) at nl.siegmann.epublib.epub.PackageDocumentReader.read(PackageDocumentReader.java:50) at nl.siegmann.epublib.epub.EpubReader.processPackageResource(EpubReader.java:79) at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:64) at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:56) at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:47)
With Bookworm online reader I could open it.
I tried other versions found online of Robinson Crusoe, and I could successfully open them with epublib, so the problem might be rather with that particular ebook than with epubllib.
Hello,
author name like "Two Words" passed to Author as one parameter is splitted when saved in a file and then read back. When there's no space in the name, everything's all right.
Thanks for investigating!
See the test case (it fails on the first assert):
@Test
public void testSimpleNameWithStoring() throws IOException {
final String SIMPLE_NAME = "Grossman a Simek";
final String DATE_FORMAT = "ddMMyy-hhmmss.SSS";
final String PATH_SEPARATOR = System.getProperty("file.separator");
final String FILENAME_PREFIX = "/tmp/EPUB-";
nl.siegmann.epublib.domain.Book book = new nl.siegmann.epublib.domain.Book();
nl.siegmann.epublib.domain.Author eauthor = new nl.siegmann.epublib.domain.Author(SIMPLE_NAME);
nl.siegmann.epublib.domain.Metadata metadata = book.getMetadata();
List<nl.siegmann.epublib.domain.Author> authors = new ArrayList<>();
authors.add(eauthor);
metadata.setAuthors(authors);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT);
String fileName = FILENAME_PREFIX.replace("/", PATH_SEPARATOR)
+ simpleDateFormat.format(new Date()) + ".txt";
EpubWriter writer = new EpubWriter();
FileOutputStream outputStream = new FileOutputStream(fileName);
writer.write(book, outputStream);
outputStream.close();
EpubReader reader = new EpubReader();
FileInputStream file = new FileInputStream(fileName);
book = reader.readEpub(file);
Metadata data = book.getMetadata();
eauthor = data.getAuthors().get(0);
assertEquals(SIMPLE_NAME, eauthor.getLastname());
assertEquals("", eauthor.getFirstname());
}
Hi there.
I've just ran an test project for android with epublib. It crashes with following stack:
I/AndroidLoggerFactory( 466): Logger name 'nl.siegmann.epublib.epub.EpubReader' exceeds maximum length of 23 characters, using 'n_.s_.e_.e_.EpubReader' instead.
I/dalvikvm( 466): Could not find method org.w3c.dom.Document.setXmlStandalone, referenced from method nl.siegmann.epublib.util.ResourceUtil.getAsDocument
W/dalvikvm( 466): VFY: unable to resolve interface method 1206: Lorg/w3c/dom/Document;.setXmlStandalone (Z)V
D/dalvikvm( 466): VFY: replacing opcode 0x72 at 0x000d
D/dalvikvm( 466): Making a copy of Lnl/siegmann/epublib/util/ResourceUtil;.getAsDocument code (52 bytes)
I/AndroidLoggerFactory( 466): Logger name 'nl.siegmann.epublib.util.ResourceUtil' exceeds maximum length of 23 characters, using 'n_.s_.e_.u_.ResourceUt_' instead.
D/dalvikvm( 466): GC freed 1180 objects / 175032 bytes in 115ms
D/dalvikvm( 466): GC freed 189 objects / 378112 bytes in 111ms
W/dalvikvm( 466): VFY: unable to find class referenced in signature (Ljavax/xml/xpath/XPathFactory;)
I/dalvikvm( 466): Could not find method javax.xml.xpath.XPathFactory.newInstance, referenced from method nl.siegmann.epublib.epub.EpubProcessorSupport.init
W/dalvikvm( 466): VFY: unable to resolve static method 274: Ljavax/xml/xpath/XPathFactory;.newInstance ()Ljavax/xml/xpath/XPathFactory;
D/dalvikvm( 466): VFY: replacing opcode 0x71 at 0x0012
D/dalvikvm( 466): Making a copy of Lnl/siegmann/epublib/epub/EpubProcessorSupport;.init code (68 bytes)
I/AndroidLoggerFactory( 466): Logger name 'nl.siegmann.epublib.epub.EpubProcessorSupport' exceeds maximum length of 23 characters, using 'n_.s_.e_.e_.EpubProces_' instead.
W/dalvikvm( 466): Exception Ljava/lang/NoClassDefFoundError; thrown during Lnl/siegmann/epublib/epub/EpubProcessorSupport;.
D/AndroidRuntime( 466): Shutting down VM
W/dalvikvm( 466): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime( 466): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 466): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 466): at nl.siegmann.epublib.util.ResourceUtil.getAsDocument(ResourceUtil.java:94)
E/AndroidRuntime( 466): at nl.siegmann.epublib.epub.EpubReader.getPackageResourceHref(EpubReader.java:115)
E/AndroidRuntime( 466): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:76)
E/AndroidRuntime( 466): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:69)
E/AndroidRuntime( 466): at nl.siegmann.epublib.epub.EpubReader.readEpub(EpubReader.java:35)
E/AndroidRuntime( 466): at com.yacool.epubtest.MainPage.onCreate(MainPage.java:28)
E/AndroidRuntime( 466): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 466): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
E/AndroidRuntime( 466): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 466): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 466): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 466): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 466): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 466): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 466): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 466): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 466): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 466): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 466): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 466): Caused by: java.lang.NoClassDefFoundError: javax.xml.xpath.XPathFactory
E/AndroidRuntime( 466): at nl.siegmann.epublib.epub.EpubProcessorSupport.init(EpubProcessorSupport.java:73)
E/AndroidRuntime( 466): at nl.siegmann.epublib.epub.EpubProcessorSupport.(EpubProcessorSupport.java:40)
My code is just:
EpubReader epubReader = new EpubReader();
Book book = epubReader.readEpub(new FileInputStream("/sdcard/alice.epub"));
I've added references for both slf4j-android-1.6.1-RC1.jar and epublib-core-latest.jar libs.
alice.epub is a standard epub book (alice in wonderland) from Guttenberg Project.
Is there something missing?
Hi,
I have shown the spines in pages but what if the spine has a long data? How can i show them in pages?? I know there has been the same issue logged but i didnt get any help :( .
Thanks,
Ritika Mittal
Currently epublib doesn't correctly handle fragments in the NCX document.
Please release to central
Thanks
Hi.
I have an issue with some sort of epub files. In the spine section there are items with ids like that:
<spine toc="ncx"> <itemref idref="titlepage"/> <itemref idref="id116"/> <itemref idref="id115"/> <itemref idref="id114"/> ...
in the manifest section they have:
<manifest> <item href="titlepage.xhtml" id="titlepage" media-type="application/xhtml+xml"/> <item href="index_split_000.xhtml" id="id116" media-type="application/xhtml+xml"/> <item href="index_split_001.xhtml" id="id115" media-type="application/xhtml+xml"/> <item href="index_split_002.xhtml" id="id114" media-type="application/xhtml+xml"/> ...
...
The problem is that (i think) as soon as the id is no file name - i got empty spine collection after executing:
spine.getSpineReferences().size() <<< 0!
In files which has spine itemref definitions like following - thre is no such problem
According to a specification i found on
http://idpf.org/epub/30/spec/epub30-publications.html#elemdef-package-item
there is no need to naming idref with file names. Is there any other explanation of this problem?
I have an epub 2.0 file. When I read the html, the content present as
< img src="../Images/...." / > is presented as < img src="image/...." / > and the stylesheet
< link href="../Styles/...." /> is fetched as < link href="css/...." / >
What is the problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.