1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00
epub.js/documentation/md/API.md
2016-11-10 23:08:39 +01:00

3.2 KiB

ePub

Creates a new Book

Parameters

  • url (string | ArrayBuffer) URL, Path or ArrayBuffer
  • options object to pass to the book
    • options.request the request function to use

Examples

ePub("/path/to/book.epub", {})

Returns Book a new Book object

Book

Creates a new Book

Parameters

  • _url string
  • options object
    • options.requestMethod method a request function to use instead of the default

Examples

new Book("/path/to/book.epub", {})

Returns Book

url

loaded

Properties

  • loaded.manifest promise A child method as property defination

open

open a url

Parameters

  • _url string URL, Path or ArrayBuffer
  • options [object] to force opening

Examples

book.open("/path/to/book.epub", { base64: false })

Returns Promise of when the book has been loaded

unpack

unpack the contents of the Books packageXml

Parameters

section

Alias for book.spine.get

Parameters

renderTo

Sugar to render a book

Parameters

  • element
  • options

requestMethod

Switch request methods depending on if book is archived or not

Parameters

  • _url

unarchive

Unarchive a zipped epub

Parameters

  • bookUrl
  • isBase64

isArchivedUrl

Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)

Parameters

  • bookUrl

coverUrl

Get the cover url

range

Find a DOM Range for a given CFI Range

Parameters

  • cfiRange

EpubCFI

EPUB CFI spec: http://www.idpf.org/epub/linking/cfi/epub-cfi.html

Implements:

  • Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)
  • Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)

Does Not Implement:

  • Temporal Offset (~)
  • Spatial Offset (@)
  • Temporal-Spatial Offset (~ + @)
  • Text Location Assertion ([)

Parameters

  • cfiFrom
  • base
  • ignoreClass