Constructor
new EpubWriter(fileName, book, optionsopt)
- Source:
 
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
fileName | 
            
            string | The filename of the .epub file  | 
        ||
book | 
            
            EpubBook | The EpubBook object  | 
        ||
options | 
            
            object | null | 
                
                    <optional> | 
            
            
                
                
                    {}
                
                 | 
            
            An object with option overrides  | 
        
Methods
(static) createNavSection(parentNode, items, navDirName)
- Source:
 
Adds a nav section to the given parentNode
Parameters:
| Name | Type | Description | 
|---|---|---|
parentNode | 
            
            Node | The parent node where the item nodes will be placed in  | 
        
items | 
            
            Array.<EpubItem> | The EpubItems to render in the section  | 
        
navDirName | 
            
            string | The directory that holds the nav file  | 
        
(static) getHeaders(node) → {string|null}
- Source:
 
TODO: Add description
Parameters:
| Name | Type | Description | 
|---|---|---|
node | 
            
            object | The JS representation of an XML node  | 
        
Returns:
TODO: Add description
- Type
 - string | null
 
(static) getPagesForItem(item) → {Array.<object>}
- Source:
 
Converts EpubHtml item into HTML pages
Parameters:
| Name | Type | Description | 
|---|---|---|
item | 
            
            EpubHtml | The item to get pages for  | 
        
Returns:
TODO: Add description
- Type
 - Array.<object>
 
(static) getPagesForItems(items) → {Array.<object>}
- Source:
 
Converts EpubHtml items into HTML pages
Parameters:
| Name | Type | Description | 
|---|---|---|
items | 
            
            EpubHtml | The items to get pages for  | 
        
Returns:
TODO: Add description
- Type
 - Array.<object>
 
(static) writeContainer(zip)
- Source:
 
Writes the container XML file to the given zip file
Parameters:
| Name | Type | Description | 
|---|---|---|
zip | 
            
            JSZip | The zip file to write the container XML file to  | 
        
(static) writeMimetype(zip)
- Source:
 
Writes the mimetype file to the given zip file
Parameters:
| Name | Type | Description | 
|---|---|---|
zip | 
            
            JSZip | The zip file to write the container XML file to  | 
        
getNavContent(item) → {string}
- Source:
 
Gets the nav page content for the given EpubNav item
Parameters:
| Name | Type | Description | 
|---|---|---|
item | 
            
            EpubNav | The EpubNav item to generate the nav page content for  | 
        
Returns:
The content of the nav page
- Type
 - string
 
getNcxContent() → {string}
- Source:
 
Gets the NCX content
Returns:
The NCX content for the EPUB file.
- Type
 - string
 
getNcxId() → {string}
- Source:
 
Gets the id of the NCX item
Returns:
The NCX id
- Type
 - string
 
getOpfBindingsNode() → {Node|null}
- Source:
 
Builds and returns the bindings node for including in the OPF file
Returns:
The bindings node or null if there are no bindings
- Type
 - Node | null
 
getOpfGuideNode() → {Node|null}
- Source:
 
Builds and returns the guide node for including in the OPF file
See http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6 for the specification
Returns:
The guide node or null if there is no guide
- Type
 - Node | null
 
getOpfManifestNode() → {Node}
- Source:
 
Builds and returns the manifest node for including in the OPF file
Returns:
The manifest node
- Type
 - Node
 
getOpfMetadataNode() → {Node}
- Source:
 
Builds and returns the metadata node for including in the OPF file
Returns:
The metadata node
- Type
 - Node
 
getOpfSpineNode() → {Node}
- Source:
 
Builds and returns the spine node for including in the OPF file
Returns:
The spine node
- Type
 - Node
 
getPackageNode() → {xmlJs.Element}
- Source:
 
Builds and returns the package node for including in the OPF file
Returns:
The metadata node
- Type
 - xmlJs.Element
 
process()
- Source:
 
Runs the the "beforeWrite" and "htmlBeforeWrite" callbacks in the configured
plugins on the book and each item in the book
write()
- Source:
 
Writes EPUB to a zip file
writeItems(zip)
- Source:
 
Writes the EPUB items to the given zip file
Parameters:
| Name | Type | Description | 
|---|---|---|
zip | 
            
            JSZip | The zip file to write the item files to  | 
        
writeOpf(zip)
- Source:
 
Writes the OPF file to the given zip file
Parameters:
| Name | Type | Description | 
|---|---|---|
zip | 
            
            JSZip | The zip file to write the OPF file to  | 
        
(async) writeToBlob()
- Source:
 
Writes EPUB to a Blob