package parser;

import java.io.File;

import com.github.mertakdut.BookSection;
import com.github.mertakdut.Reader;
import com.github.mertakdut.exception.OutOfPagesException;
import com.github.mertakdut.exception.ReadingException;

public class EpubParser {

	public void parseBook(File book) {
		Reader reader = new Reader();
		reader.setMaxContentPerSection(1000);
		reader.setIsIncludingTextContent(true);
		try {
			reader.setFullContent(book.getAbsolutePath());

			BookSection bookSection = reader.readSection(100);
			String sectionContentAsHtml = bookSection.getSectionContent();
			String sectionContentAsText = bookSection.getSectionTextContent();

			System.out.println(sectionContentAsText);

		} catch (ReadingException e) {
			e.printStackTrace();
		} catch (OutOfPagesException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
