Tools, FAQ, Tutorials:
Hello-2.0.epub - Package File: package.opf
How to create a package file like package.opf for an EPUB 2.0.1 book?
✍: FYIcenter.com
At least one package file, like package.opf, is required for
an EPUB 2.0.1 book in the book ZIP container.
It defines required meta data and specifies 2 required content files.
Here is the requirement on a package file:
1. A package file must be named with .opf file extension.
2. A package file must be an XML file and meet the "Open Packaging Format (OPF) 2.0.1" specifications.
3. A package file must specify version="2.0" in the "package" XML element.
4. A package file must specify a unique-identifier and several meta data elements. For example:
<dc:title>Hello</dc:title> <dc:identifier id="id">fyicenter.com.epub.hello</dc:identifier> <dc:language>en-US</dc:language>
5. A package file must specify at least files: an XML file to provide navigation information of the book, an XHTML file to provide the content of the book.
6. A package file can be placed in any directory of the EPUB 2.0.1 book ZIP container. But its exact location must be specified correctly in the "container.xml" file.
You can create a package file with any text editor. Here is an example called package.opf:
<?xml version="1.0" encoding="UTF-8"?> <!-- package.opf Copyright (c) 2018 FYIcenter.com --> <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="id"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:title>Hello</dc:title> <dc:identifier id="id">fyicenter.com.epub.hello</dc:identifier> <dc:language>en-US</dc:language> </metadata> <manifest> <item id="navigation" href="/navigation.xml" media-type="application/x-dtbncx+xml"/> <item id="content" href="/content.xhtml" media-type="application/xhtml+xml"/> </manifest> <spine toc="navigation"> <itemref idref="content"/> </spine> </package>
Download Hello-2.0.epub, and unzip it. You see an example of "package.opf" in the root directory.
⇒ Hello-2.0.epub - Navigation File: navigation.xml
⇐ Hello-2.0.epub - "container.xml" File
2019-01-14, 1389👍, 0💬
Popular Posts:
How To Remove Slashes on Submitted Input Values in PHP? By default, when input values are submitted ...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
How To Connect to MySQL from a PHP Script in PHP? If you want access the MySQL server, you must crea...
What is EPUB 2.0 Metadata "dc:creator" and "dc:contributor" elements? EPUB 2.0 Metadata "dc:creator"...
How to send an FTP request with the urllib.request.urlopen() function? If an FTP server supports ano...