Moodle Plugins directory: EPUB import | Moodle.org
EPUB import
EPUB Import for Book allows teachers and administrators to import EPUB ebooks directly into Moodle's Book resource. It supports both reflowable and fixed-layout EPUB formats.
Features:
Reflowable EPUB import — Automatically splits ebooks into Book chapters using the EPUB's table of contents. Preserves headings, images, links, and formatting. Falls back to heading-based splitting when no TOC is present.,
Fixed-layout EPUB import — Extracts page images and creates one chapter per page, suitable for page-image ebooks (textbooks, comics, illustrated guides).,
Two import workflows — Create a new Book resource from an EPUB, or replace the contents of an existing Book.,
Image and media handling — All embedded images are imported through Moodle's file API with proper @@PLUGINFILE@@ rewriting.,
Security — XXE (XML External Entity) attack mitigation, input sanitization, and capability-based access control.,
Privacy API — Full GDPR compliance. The plugin does not store any user data.,
PHPUnit tests — Includes test suite with fixture EPUBs for parser and TOC mapper validation.,
Requirements: PHP 8.1+, PHP zip extension.
Optional: For fixed-layout EPUBs that use CSS-positioned text overlays (e.g., some digital textbooks), a standalone Node.js pre-rendering tool is included in the cli/ directory. This is not required for standard EPUB import.
This plugin is a complete rewrite of the original Lucimoo EPUB import plugin by Mikael Ylikoski, modernized for Moodle 4.5+ with a modular OOP architecture, namespaced classes, and current Moodle API usage.
I tested booktool_epubimport 2.0.0-beta2 (2026041100) on a local Moodle site before considering it for production use. The plugin page lists support for Moodle 4.4, 4.5, 5.0, 5.1, and 5.2.
The plugin installed successfully and appears under Book tools as:
EPUB import
booktool_epubimport
2.0.0-beta2
2026041100
The capability booktool/epubimport:import was also created correctly and was available for Teacher and Manager roles.
However, I ran into several issues during testing:
1. The EPUB import option did not appear in the standard Book activity tools/menu area. I could see the normal Book tools such as Import chapter, Print book, Print chapter, Generate IMS CP, and Permissions, but I did not see an EPUB import option. I was only able to reach the EPUB import page by manually changing the URL to the epubimport tool path.
2. Once I reached the import page directly, the import initially failed with:
Exception - Class "notification" not found
In mod/book/tool/epubimport/index.php, the plugin references:
notification::NOTIFY_SUCCESS
notification::NOTIFY_ERROR
Changing those to the Moodle namespaced output notification class allowed the process to continue:
\core\output\notification::NOTIFY_SUCCESS
\core\output\notification::NOTIFY_ERROR
3. After that change, the import process reached the EPUB handling step, but failed with the generic message:
The EPUB import could not be completed. Please check the EPUB package and try again.
I tested more than one EPUB file and received the same result.
4. My local PHP environment has ZIP and XML support enabled:
zip
libxml
xml
xmlreader
xmlwriter
I also saw a related review note from April 8, 2026 that listed several items needing attention, including incorrect repository name, missing boilerplate headers, insecure directory permissions, PHPDoc inconsistency, hard-coded language strings, JS implementation updates, and missing language string definitions.
Because this release is listed as supporting Moodle 4.5/5.0+, I wanted to report both the missing Book menu/tool link and the runtime/import errors.
Questions:
* Should EPUB import appear as a visible option in the standard Book activity tools menu?
* Is there an additional setting required to make the EPUB import tool appear in the Book interface?
* Is Node.js/Playwright required only for fixed-layout EPUBs, or can the importer trigger that requirement for other EPUBs too?
* Is there a way to expose the actual caught exception instead of only the generic “EPUB package” message?
* Are there specific EPUB formatting requirements or sample EPUB files recommended for testing?
* Have the April 8 review items been fully resolved in 2.0.0-beta2?
Thank you for working on this plugin. EPUB-to-Book import would be very useful, but based on this testing I would not be comfortable moving it to a production Moodle site yet without clarification or a fix.
Yes, EPUB import should appear visibly in the Book activity tools/menu for users with the capability.
No additional setting should be required beyond capability + being in a Book activity.
Node/Playwright should only matter for special fixed-layout/CSS-overlay handling, not standard reflowable EPUBs.
Yes, we should expose/log the caught exception for admins while keeping the user-facing message polite.
The repo has test.