Skip to content

leeduan/generate-opf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Generate OPF

Creates an *.opf file for your ePub 3.0 e-book by scanning through OPS and its children.

Getting Started

  1. Clone the repository.
  2. Check that ruby is installed (tested on v2.0.0 and higher).
ruby -v
  1. Check that the container.xml file located in META-INF directory has a full-path specified:
<rootfile full-path="OPS/content.opf" media-type="application/oebps-package+xml" />
  1. mv the generate_opf.rb file into your ePub's OPS directory.
  2. cd into your OPS directory.
  3. Run the program with the command:
ruby generate_opf.rb
  1. rm the generate_opf.rb file from OPS directory.
  2. Reorder spine items if desired e-book order is not in file-name ascending order.
  3. Package up ePub and check for errors using ePub Checker.

ePub Requirements

  1. Folder structure must be in ePub 3.0 format.
  2. All e-book content files must exist within OPS and its children.
  3. All text files to be added to spine must be *.xhtml and exist in or down one directory relative to OPS:
  • /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.
  1. 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.
  1. Files with extensions not listed below will not be added to the OPF file.
  2. Additional rendition settings are not generated.

File Extension Compatibility

  • 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

License

Generate OPF is released under the MIT License.

Issues

Please report an issue if you run into any bugs or have feature requests.

About

Create a valid OPF manifest file for your ePub

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages