I have tried following code for reading epub file created by
using pdf to epub converter,but i didnt got the content
of file as output so kindly solve my problem
package net.learn2develop.Eread;
//import java.awt.print.Book;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import nl.siegmann.epublib.domain.Book;
//import org.example.mymenu.Book;
//import nl.siegmann.epublib.domain.TocReference;
//import nl.siegmann.epublib.epub.epubReader;
import android.app.Activity;
import android.content.res.AssetManager;
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
/**
* Log the info of 'assets/books/testbook.epub'.
*
* @author paul.siegmann
*
*/
public class Eread extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AssetManager assetManager = getAssets();
try {
// find InputStream for book
InputStream epubInputStream = assetManager
.open("/assets/comi.epub");
// Load Book from inputStream
Book book = (new Eread()).readEpub(epubInputStream);
} catch (IOException e) {
Log.e("epublib", e.getMessage());
}
}
Book readEpub(InputStream epubInputStream) {
// TODO Auto-generated method stub
Eread epubReader = new Eread();
try {
Book book = epubReader.readEpub(new
FileInputStream("comi.epub"));
// book.getTableOfContents();
// book.getContents();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment