Search in sources :

Example 11 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testAnnotationBeforeBodyParagraph.

public void testAnnotationBeforeBodyParagraph() {
    BookModel bookModel = new BookModel(myDirectory + "annotation_before.fb2");
    new FB2Reader(bookModel).read();
    ZLTextModel model = bookModel.getBookTextModel();
    assertEquals(model.getParagraph(1).getKind(), ZLTextParagraph.Kind.END_OF_SECTION_PARAGRAPH);
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) ZLTextModel(org.geometerplus.zlibrary.text.model.ZLTextModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Example 12 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testNotesSimple.

public void testNotesSimple() {
    BookModel model = new BookModel(myDirectory + "simple_notes.fb2");
    new FB2Reader(model).read();
    assertNotNull(model.getFootnoteModel("1"));
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader)

Example 13 with FB2Reader

use of org.geometerplus.fbreader.formats.fb2.FB2Reader in project FBReaderJ by geometer.

the class TestFB2Reader method testImage.

/*	public void testPnvs() {
		FB2Reader reader = new FB2Reader("M:/Books/pnvs.fb2");
		reader.read();
	}
*/
public void testImage() {
    BookModel model = new BookModel(myDirectory + "image.fb2");
    new FB2Reader(model).read();
    byte[] image = (model.getImageMap().getImage("cover.jpg")).byteData();
    try {
        BufferedImage img = ImageIO.read(new ByteArrayInputStream(image));
        ImageIO.write(img, "jpg", new File(myDirectory + "img.jpg"));
    } catch (IOException e) {
        fail();
    }
}
Also used : BookModel(org.geometerplus.fbreader.bookmodel.BookModel) FB2Reader(org.geometerplus.fbreader.formats.fb2.FB2Reader) BufferedImage(java.awt.image.BufferedImage)

Aggregations

BookModel (org.geometerplus.fbreader.bookmodel.BookModel)13 FB2Reader (org.geometerplus.fbreader.formats.fb2.FB2Reader)13 ZLTextModel (org.geometerplus.zlibrary.text.model.ZLTextModel)8 ZLTextParagraph (org.geometerplus.zlibrary.text.model.ZLTextParagraph)2 BufferedImage (java.awt.image.BufferedImage)1 ContentsModel (org.geometerplus.fbreader.bookmodel.ContentsModel)1 ZLImageEntry (org.geometerplus.zlibrary.text.model.impl.ZLImageEntry)1 ZLSwingPaintContext (org.geometerplus.zlibrary.ui.swing.view.ZLSwingPaintContext)1