Overview
This node converts HTML content into an EPUB eBook file. It supports input HTML either as binary data or as a string within JSON. The node parses the HTML, splits it into chapters based on <h1 class="chapter"> headings, and generates a styled EPUB file with metadata such as title, author, and language.
Common scenarios:
- Automating the creation of eBooks from web-scraped or user-provided HTML content.
- Converting blog posts, articles, or documentation stored in HTML format into portable EPUB files.
- Generating customized eBooks dynamically in workflows for distribution or archiving.
Practical example:
You have a collection of HTML documents representing chapters of a book. Using this node, you can convert them into a single EPUB file with proper chapter navigation, styling, and metadata, ready to be read on any EPUB-compatible device or app.
Properties
| Name | Meaning |
|---|---|
| Input Mode | Source of the input HTML. Options: "Binary (HTML)" or "String (HTML)". |
| Binary Property Name | Name of the binary property containing the HTML input (used if Input Mode is "binary"). |
| JSON Property Name with HTML | Name of the JSON key containing the raw HTML string (used if Input Mode is "string"). |
| Title | Optional title to set in the EPUB metadata. |
| Author | Author name to set in the EPUB metadata. Defaults to "Unknown". |
| Language | Language code of the book (e.g., "en" for English). Defaults to "en". |
| EPUB File Name | Filename for the output EPUB file. Defaults to "book.epub". |
| Output Binary Property Name | Name of the binary property where the generated EPUB file will be written. Defaults to "data". |
Output
The node outputs the generated EPUB file as binary data under the specified output binary property name (default "data"). Additionally, it adds metadata to the JSON output including:
uuid: Unique identifier (UUID) of the EPUB book.title: Title of the EPUB.author: Author of the EPUB.language: Language code of the EPUB.chapters: Number of chapters detected in the HTML.
The EPUB binary contains all necessary files (XHTML chapters, CSS, navigation files) packaged according to the EPUB 2.0 standard.
Dependencies
- Uses the
cheeriolibrary to parse and manipulate HTML. - Uses Node.js
zlibfor compression of EPUB contents. - No external API or service dependencies; all processing is local.
- Requires n8n helpers for handling binary data input/output.
Troubleshooting
Error: The JSON property 'X' must contain a non-empty HTML string.
This occurs when the specified JSON property for HTML input is missing or empty while using string input mode. Ensure the property exists and contains valid HTML.Invalid binary property name or missing binary data.
When using binary input mode, verify that the binary property name matches the actual binary data property containing the HTML.Malformed HTML input may cause unexpected EPUB structure.
The node expects well-formed HTML with chapters marked by<h1 class="chapter">. If chapters are not detected, the entire content is treated as one chapter.Output EPUB file cannot be opened in readers.
Check that the input HTML is valid and that the EPUB filename has the.epubextension.