Basic Usage

Advanced Usage

importmkepubbook=mkepub.Book(title='Advanced Example',author='The Author')# multiple authors can be specified as a list:# mkepub.Book(title='Advanced Example', authors=['The First Author', 'The Second Author'])withopen('cover.jpg','rb')asfile:book.set_cover(file.read())withopen('style.css')asfile:book.set_stylesheet(file.read())first=book.add_page('Chapter 1','And so the book begins.')child=book.add_page('Chapter 1.1','Nested TOC is supported.',parent=first)book.add_page('Chapter 1.1.1','Infinite nesting levels',parent=child)book.add_page('Chapter 1.2','In any order you wish.',parent=first)book.add_page('Chapter 2','Use <b>html</b> to make your text <span class="pink">prettier</span>')book.add_page('Chapter 3: Images','<img src="images/chapter3.png" alt="You can use images as well">')# as long as you add them to the book:withopen('chapter3.png','rb')asfile:book.add_image('chapter3.png',file.read())book.save('advanced.epub')