epub3(epub-rs 3.0)

epub3 is an implement of epub-rs.

Support epub: 2.0, 2.0.1, 3.0, 3.0.1, 3.2, 3.3.

Reader and Writer with content are fully tested.

Example with dart:io

import 'package:epub3/epub3_io.dart' as epub;

final book = epub.readFile('test/res/alice.epub')!;
print(book.version);  // Version.epub3
print(book.title);    // Alice's Adventures...
print(book.author);   // Lewis Carroll
print(book.chapters); // first level chapters

Example without dart:io

import 'package:epub3/epub3.dart' as epub;
import 'package:archive/archive.dart';

final book = epub.Reader.
  open(ZipDecoder().
  decodeBytes(bytes_or_file_content)).
  read();

Example write a new epub file

The new.epub file generated by this example passed epubcheck

import 'package:epub3/epub3_io.dart' as epub;

final book = epub.Book.create(
  title: 'dream world',
  author: 'joe doe',
);

book.add(
  epub.Chapter(title: 'Part 1', children: [
    epub.Chapter.content('Chapter 1', 'Content of Chapter 1'),
    epub.Chapter.content('Chapter 2', 'Content of Chapter 2'),
  ]),
);

epub.writeFile(book, 'new.epub');

Libraries

epub3
epub3_io