EPUB


EPUB is an e-book file format that uses the ".epub" file extension. The term is short for electronic publication and is sometimes stylized as ePUB. EPUB is supported by many e-readers, and compatible software is available for most smartphones, tablets, and computers. EPUB is a technical standard published by the International Digital Publishing Forum. It became an official standard of the IDPF in September 2007, superseding the older Open eBook standard.
The Book Industry Study Group endorses EPUB 3 as the format of choice for packaging content and has stated that the global book publishing industry should rally around a single standard. Technically, a file in the EPUB format is a ZIP archive file consisting of XHTML files carrying the content, along with images and other supporting files. EPUB is the most widely supported vendor-independent XML-based e-book format; it is supported by almost all hardware readers and many software readers and mobile apps.

History

A successor to the Open eBook Publication Structure, EPUB 2.0 was approved in October 2007, with a maintenance update approved in September 2010.
The EPUB 3.0 specification became effective in October 2011, superseded by a minor maintenance update in June 2014. New major features include support for precise layout or specialized formatting, such as for comic books, and MathML support. The current version of EPUB is 3.2, effective May 8, 2019. The format specification underwent reorganization and clean-up; format supports remotely hosted resources and new font formats and uses more pure HTML and CSS.
In May 2016 IDPF members approved World Wide Web Consortium merger, "to fully align the publishing industry and core Web technology".

Version 2.0.1

EPUB 2.0 was approved in October 2007, with a maintenance update intended to clarify and correct errata in the specifications being approved in September 2010. EPUB version 2.0.1 consists of three specifications:
  • Open Publication Structure 2.0.1, contains the formatting of its content.
  • Open Packaging Format 2.0.1, describes the structure of the .epub file in XML.
  • Open Container Format 2.0.1, collects all files as a ZIP archive.
EPUB internally uses XHTML or DTBook to represent the text and structure of the content document, and a subset of CSS to provide layout and formatting. XML is used to create the document manifest, table of contents, and EPUB metadata. Finally, the files are bundled in a zip file as a packaging format.

Open Publication Structure 2.0.1

An EPUB file uses XHTML 1.1 to construct the content of a book as of version 2.0.1. This is different from previous versions, which used a subset of XHTML. There are, however, a few restrictions on certain elements. The MIME type for XHTML documents in EPUB is application/xhtml+xml.
Styling and layout are performed using a subset of CSS 2.0, referred to as OPS Style Sheets. This specialized syntax requires that reading systems support only a portion of CSS properties and adds a few custom properties. Custom properties include oeb-page-head, oeb-page-foot, and oeb-column-number. Font-embedding can be accomplished using the @font-face property, as well as including the font file in the OPF's manifest. The MIME type for CSS documents in EPUB is text/css.
EPUB also requires that PNG, JPEG, GIF, and SVG images be supported using the MIME types image/png, image/jpeg, image/gif, image/svg+xml. Other media types are allowed, but creators must include alternative renditions using supported types. For a table of all required MIME types, see of the specification.
Unicode is required, and content producers must use either UTF-8 or UTF-16 encoding. This is to support international and multilingual books. However, reading systems are not required to provide the fonts necessary to display every Unicode character, though they are required to display at least a placeholder for characters that cannot be displayed fully.
An example skeleton of an XHTML file for EPUB looks like this:






Pride and Prejudice



...


Open Packaging Format 2.0.1

The OPF specification's purpose is to " the mechanism by which the various components of an OPS publication are tied together and provides additional structure and semantics to the electronic publication". This is accomplished by two XML files with the extensions .opf and .ncx.
.opf file
The OPF file, traditionally named content.opf, houses the EPUB book's metadata, file manifest, and linear reading order. This file has a root element package and four child elements: metadata, manifest, spine, and guide. Furthermore, the package node must have the unique-identifier attribute. The.opf file's MIME type is application/oebps-package+xml.
The metadata element contains all the metadata information for a particular EPUB file. Three metadata tags are required : title, language, and identifier. title contains the title of the book, language contains the language of the book's contents in RFC 3066 format or its successors, such as the newer RFC 4646 and identifier contains a unique identifier for the book, such as its ISBN or a URL. The identifier's id attribute should equal the unique-identifier attribute from the package element.
The manifest element lists all the files contained in the package. Each file is represented by an item element, and has the attributes id, href, media-type. All XHTML, stylesheets, images or other media, embedded fonts, and the NCX file should be listed here. Only the .opf file itself, the container.xml, and the mimetype files should not be included.
The spine element lists all the XHTML content documents in their linear reading order. Also, any content document that can be reached through linking or the table of contents must be listed as well. The toc attribute of spine must contain the id of the NCX file listed in the manifest. Each itemref element's idref is set to the id of its respective content document.
The guide element is an optional element for the purpose of identifying fundamental structural components of the book. Each reference element has the attributes type, title, href. Files referenced in href must be listed in the manifest, and are allowed to have an element identifier.
An example OPF file:




Pride and Prejudice
en
123456789X
Jane Austen

















.ncx file
The NCX file, traditionally named toc.ncx, contains the hierarchical table of contents for the EPUB file. The specification for NCX was developed for Digital Talking Book, is maintained by the DAISY Consortium, and is not a part of the EPUB specification. The NCX file has a MIME type of application/x-dtbncx+xml.
Of note here is that the values for the docTitle, docAuthor, and meta name="dtb:uid" elements should match their analogs in the OPF file. Also, the meta name="dtb:depth" element is set equal to the depth of the navMap element. navPoint elements can be nested to create a hierarchical table of contents. navLabel's content is the text that appears in the table of contents generated by reading systems that use the.ncx. navPoint's content element points to a content document listed in the manifest and can also include an element identifier.
A description of certain exceptions to the NCX specification as used in EPUB is in Section 2.4.1 of the specification. The complete specification for NCX can be found in the Specifications for the Digital Talking Book.
An example.ncx file:


"http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">








Pride and Prejudice


Austen, Jane



Chapter 1