Members
direction
- Source:
Sets the direction for this EPUB.
Methods
addAuthor(author, fileAsopt, roleopt, uidopt)
- Source:
Adds an author for this EPUB.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
author |
string | The name of the author |
||
fileAs |
string | null |
<optional> |
null
|
The normalized author name for sorting (or null to omit it) |
role |
string | null |
<optional> |
null
|
The author's role (or null to omit it) |
uid |
string |
<optional> |
"creator"
|
The unique identifier of the author |
addItem(item)
- Source:
Adds an additional item to the EPUB. If not defined, the media type and chapter id
will be defined for the item.
Parameters:
Name | Type | Description |
---|---|---|
item |
EpubItem | The item to add to the EPUB |
addMetadata(namespace, name, value, others)
- Source:
Adds metadata
Parameters:
Name | Type | Default | Description |
---|---|---|---|
namespace |
string | TODO: Add description |
|
name |
string | TODO: Add description |
|
value |
string | TODO: Add description |
|
others |
object |
null
|
TODO: Add description |
addPrefix(name, uri)
- Source:
Appends a custom prefix to the list of prefixes to be added
to the content.opf document
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the namespace |
uri |
string | The URI for the namespace |
getItems() → {Array.<EpubItem>}
- Source:
Returns all the items that are attached to this EPUB.
Example
Example usage of getItems.
// Returns the list of items
book.getItems()
Returns:
The array of items
- Type
- Array.<EpubItem>
getItemsOfMediaType(mediaType) → {Array.<EpubItem>}
- Source:
Returns all the items with the given media type that are attached to this EPUB.
Example
Example usage of getItemsOfMediaType.
// Returns the list of items
book.getItemsOfMediaType('application/octet-stream')
Parameters:
Name | Type | Description |
---|---|---|
mediaType |
string | Media type of the item to search for |
Returns:
The array of items
- Type
- Array.<EpubItem>
getItemsOfType(itemType) → {Array.<EpubItem>}
- Source:
Returns all the items of the given item type that are attached to this EPUB.
Example
Example usage of getItemsOfType.
// Returns the list of items
book.getItemsOfType(ItemTypeEnum.IMAGE)
Parameters:
Name | Type | Description |
---|---|---|
itemType |
ItemTypeEnum | Item type of the item to search for |
Returns:
The array of items
- Type
- Array.<EpubItem>
getItemWithHref(href) → {EpubItem|null}
- Source:
Returns either the item for the defined href or null if the item
can't be found.
Example
Example usage of getItemWithHref.
// Returns the found item
book.getItemWithHref('EPUB/document.xhtml')
Parameters:
Name | Type | Description |
---|---|---|
href |
string | HREF for the item to search for |
Returns:
The found item or null if the item can't be found
- Type
- EpubItem | null
getItemWithId(uid) → {EpubItem|null}
- Source:
Returns either the item for the defined UID or null if the item
can't be found.
Example
Example usage of getItemWithId.
// Returns the found item
book.getItemWithId('image_001')
Parameters:
Name | Type | Description |
---|---|---|
uid |
string | Item id to search for |
Returns:
The found item or null if the item can't be found
- Type
- EpubItem | null
getMetadata(namespace, name) → {Array.<object>}
- Source:
Retrieves metadata
Parameters:
Name | Type | Description |
---|---|---|
namespace |
string | TODO: Add description |
name |
string | TODO: Add description |
Returns:
TODO: Add description
- Type
- Array.<object>
getTemplate(templateType) → {string}
- Source:
Get the template for the given template type.
Example
Example usage of getTemplate.
// Returns the template as a string
book.getTemplate(TemplateType.NAV)
Parameters:
Name | Type | Description |
---|---|---|
templateType |
TemplateTypeEnum | The template to update |
Returns:
The value of the template
- Type
- string
reset()
- Source:
Initialized all needed variables to default values
setCover(fileName, content, createPage)
- Source:
Sets the cover and creates the cover document if needed.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
fileName |
string | The file name of the cover page |
|
content |
string | Content for the cover page |
|
createPage |
boolean |
true
|
Should cover page be defined. Defined as bool value (optional). Defaults to true |
setIdentifier(value)
- Source:
Sets the unique identifier for this EPUB.
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The id of the book |
setLanguage(value)
- Source:
Sets the language for this EPUB. You can set multiple languages. Specific items in the book
can have different language settings.
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The new language code |
setTemplate(templateType, value)
- Source:
Sets the template for the given template type.
Example
Example usage of setTemplate.
book.setTemplate(TemplateType.NAV, '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"/>')
Parameters:
Name | Type | Description |
---|---|---|
templateType |
TemplateTypeEnum | The template to update |
value |
string | The new template value |
setTitle(value)
- Source:
Sets the title for this EPUB. You can set multiple titles.
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The new title |
setUniqueMetadata(namespace, name, value, others)
- Source:
Adds metadata if metadata with this identifier does not already exist,
otherwise update existing metadata.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
namespace |
string | TODO: Add description |
|
name |
string | TODO: Add description |
|
value |
string | TODO: Add description |
|
others |
object |
null
|
TODO: Add description |