Creates an *.opf
file for your ePub 3.0 e-book by scanning through OPS
and its children.
- Clone the repository.
- Check that ruby is installed (tested on v2.0.0 and higher).
ruby -v
- Check that the
container.xml
file located inMETA-INF
directory has a full-path specified:
<rootfile full-path="OPS/content.opf" media-type="application/oebps-package+xml" />
mv
thegenerate_opf.rb
file into your ePub'sOPS
directory.cd
into yourOPS
directory.- Run the program with the command:
ruby generate_opf.rb
rm
thegenerate_opf.rb
file fromOPS
directory.- Reorder spine items if desired e-book order is not in file-name ascending order.
- Package up ePub and check for errors using ePub Checker.
- Folder structure must be in ePub 3.0 format.
- All e-book content files must exist within
OPS
and its children. - All text files to be added to spine must be
*.xhtml
and exist in or down one directory relative toOPS
:
/OPS/Text/page_0001.xhtml
is supported./OPS/page_0001.xhtml
is supported./OPS/Chapters/Texts/page_0001.xhtml
is not supported./OPS/page_0001.html
is not supported.
- Naming convention of table of content files should be:
toc.xhtml
is preferred; a file following*toc.xhtml
naming convention is supported.toc.ncx
is optional fallback and not required for ePub 3.0 validation.
- Files with extensions not listed below will not be added to the OPF file.
- Additional rendition settings are not generated.
- Images: jpeg, jpg, png, gif, svg
- Fonts: eot, woff, ttf, otf
- JavaScript: js
- Video: m4v, mp4, mov
- Audio: mp3, m4a
- Text: html, xhtml
- TOC: ncx, xhtml
Generate OPF is released under the MIT License.
Please report an issue if you run into any bugs or have feature requests.