Hello-3.2.epub - EPUB 3.2 Simple Demonstration

Q

How to build a simple EPUB file to demonstrate some EPUB 3.2 features?

✍: FYIcenter.com

A

You can follow this tutorial to build a simple EPUB file to demonstrate some EPUB 3.2 features

Create 5 required files and place them according to the following structure:

├── mimetype
├── META-INF
│   └── container.xml
├── content.xhtml
├── navigation.xhtml
└── package.opf

1. The "mimetype" file must be named as "mimetype". It is the same as in EPUB 3.1.

2. The "container.xml" file must be an XML file and placed in a sub-directory called META-INF. It is the same as in EPUB 3.1.

3. The package file must be named with .opf file extension. Its name and location are specified in the "container.xml" file, for example, "./package.opf".

Since "authority" and "term" properties are added for "dc:subject" in EPUB 3.2. The following was added in package.opf to demonstrate this feature.

<!-- Added in EPUB 3.2 -->
<dc:subject id="subject01">FICTION / Occult & Supernatural</dc:subject>
<meta refines="#subject01" property="authority">BISAC</meta>
<meta refines="#subject01" property="term">FIC024000</meta>

4. The navigation file can be placed in any sub-directory, for example, ./navigation.xhtml. Its location must be specified correctly in the package file.

5. The content file can be placed in any sub-directory, for example, ./content.xhtml. Its exact location must be specified correctly in the package file.

When you have all 5 files ready, you can build Hello-3.2.epub with WinRAR on Windows computers:

C:C:\fyicenter> WinRAR a -afzip Hello-3.2.epub mimetype
C:C:\fyicenter> WinRAR a Hello-3.2.epub META-INF\container.xml
C:C:\fyicenter> WinRAR a Hello-3.2.epub package.opf
C:C:\fyicenter> WinRAR a Hello-3.2.epub navigation.xhmtl
C:C:\fyicenter> WinRAR a Hello-3.2.epub content.xhtml

You can also build Hello-3.2.epub with "zip" command on Linux/macOS computers:

fyicenter$ zip -0X Hello-3.2.epub mimetype
fyicenter$ zip -X Hello-3.2.epub META-INF
fyicenter$ zip -X Hello-3.2.epub META-INF/container.xml
fyicenter$ zip -X Hello-3.2.epub package.opf
fyicenter$ zip -X Hello-3.2.epub navigation.xhmtl
fyicenter$ zip -X Hello-3.2.epub content.xhtml

Once the Hello-3.2.epub file is created, you can validate it with EpubCheck:

C:C:\fyicenter> java -jar \fyicenter\epubcheck\epubcheck.jar Hello-3.2.epub

Validating using EPUB version 3.2 rules.
No errors or warnings detected.
Messages: 0 fatals / 0 errors / 0 warnings / 0 infos

EPUBCheck completed

If you want to see those 5 required files in Hello-3.2.epub, you can click Hello-3.2.epub to download. Unzip Hello-3.2.epub, you will see all 5 files.

 

Introduction of EPUB 2.0 Specification

Changes on EPUB OCF 3.2

Introduction of EPUB 3.2 Specification

⇑⇑ EPUB Tutorials

2022-02-09, 843🔥, 0💬