Languages
This article
in Italian

Tutorial and Step-by-step procedure

ePub

The EPUB format is increasingly used as a standard for the eBook, this tutorial is dedicated to anyone who would like to know how and ePub eBook it made "inside".

Procedure
1) Find an eBook in ePUB format
[HELP] -> you can download several free eBooks from our catalog www.steppa.net/ebook/

2) Rename the file extension from .epub to .zip and open it
inside you will find files and folders

ePub in zip

3) Open the file mimetype
[HELP] -> extract it from the archive -> open it with any text editor (eg notepad)
Inside you will read:
application/epub+zip
the mandatory file mimetype must be a text document (coded in ASCII, not compressed and not encrypted) and must contain the words we found.
Why? The standard specifications state that this is a safer way for programs to identify the EPUB format, instead of using just the file extension .epub for the files.
Now let's have a look to the folders: OEBPS and META-INF

4) Unzip and open the folder META-INF
you will find one or two files

5) Open the file container.xml
in the folder of an ePUB downloaded from our free catalogue, we will find just the mandatory file called container.xml
inside this XML filed you will find the path in order to find the .opf format file, that defines the eBook that the reader will have to open.
A sshown below, it is written that the files is located in the folder OEBPS and its name is content.opf
<rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>

7) When the eBook is protected, in this folder there will be also a file named rights.xml but this is not our case, because all the eBook downloadable from the catalogue in our website www.steppa.net are DRM Free, this means they do not have protections that will prevent from using the files with readers different than the one registred during the eBook download.

8) Let's see the next folders and open the one called OEBPS, inside there are others folders and files.

9) Open the file toc.ncx using a text editor, as you have done before.
This file is more complex than the others because the .ncx (Navigation Control file for XML) contains the index of the eBook content (TOC = Table of Contents).
Here we can find the book title <docTitle>, the author <docAuthor> and the document navigatin rules <navPoint id="identificativo" playOrder="numero"> that usually are the chapter sequence.
Notare che alcuni parametri in questo file saranno ripetuti in altri file.

10) Open the file content.opf
The OPS file (Open Packaging Format) define the structure of the .epub file in XML format
Here will be repeted the title and the author, the metadata (data with information about the book), the path of the file toc.ncx we have seen before and, most important, the location of all the files that are part of the book, (text in .xhtml format and images that can use the formats: PNG, JPEG, GIF or SVG)

11) Open the text folder with all the text files of our eBook.
the code at the beginning:
<link rel="stylesheet" href="../Styles/style001.css" type="text/css" />
indicates were to find the information to apply a specific "style" to the text (italic, bold, justified and so on.)
the rest is coded in html language, the same language used to write this Web page you are reading.
Also the position of the images inside the texh is indicated in standard HTML language.
In this example, the code found in the cover: <img alt="" src="../Images/img0002.jpg" />
states that in order to find the image to insert in that position it is necessary to:
- go back of one folder (../)
- open the folder called Images/
- insert the file named img0002.jpg

12) Go back of one folder and open the other folder named Images
where are stored all the images that will be used by the text files seen before.

13) Open the last folder called Styles.

14) Open the file style001.css
to find all the information about the different styles used by the text.

For example, the style:
font-size: 1em;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
page-break-before: always;
text-align: justify

Some information on the examined eBook.
This is one of my fiction books, it has been produced using the freeware program Calibre for a first conversion from the .odt (Open Office) of the original to epub and than reformatted using the freeware program Sigil. To test the final product we used a Sony PRS600 eBook reader.
In order to read and produce books in ePUB format it is not necessary to know their inner structure, just use the proper programs (Calibre to read, manage and a first conversion of the eBooks and Sigil to produce them).

  ePUB logo   

References

idpf specifications (International Digital Publishing Forum) about the ePUB

Additional information:

 NOTE: No eBook was mistreated during the writing of this article, at the end of the study the subject in question was restored to its original state. No copyright has been violated, the eBook Chiusi in fabbrica is a book written by the author of this article.