The eBook Design and Development Guide
For complete access to all the templates, tips, and tricks that BB eBooks uses for eBook production, please consider buying the eBook Design and Development Guide at Amazon for only $6.99. In it you will find comprehensive HTML, CSS, and Regular Expression tutorials, as well as a step-by-step workflow for turning a sloppy manuscript into a beautiful eBook that is only available in this guide. A PDF version is available upon request following purchase.
container.xml file
This XML file must be in a directory called META-INF. The full-path attribute specified in the rootfile element points towards the OPF file relative to the root directory.
<?xml version="1.0"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
content.opf file
This XML file should be in a directory called OEBPS. The relative paths in the manifest section are relative to the opf file if you want to have your HTML, CSS, and images in separate directories.
<?xml version="1.0" encoding="utf-8" ?>
<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
<dc:title>Crime and Punishment</dc:title>
<dc:language>en-us</dc:language>
<dc:identifier id="BookId" opf:scheme="uuid">urn:uuid:3e3f969b-c287-4327-bcdd-4f7eda7c9411</dc:identifier>
<dc:creator opf:role="aut">Fyodor Dostoevsky</dc:creator>
<dc:publisher>BB eBooks</dc:publisher>
<dc:date>2012-06-15</dc:date>
<meta name="cover" content="My_Cover_ID" />
<dc:description>This is classic Russian literature!</dc:description>
<dc:subject>Russian</dc:subject>
<dc:subject>Classics</dc:subject>
<dc:rights>All rights reserved</dc:rights>
<dc:type>Text</dc:type>
<dc:source>Can be a URL or ISBN number</dc:source>
<dc:relation>Can be a URL or ISBN number</dc:relation>
<dc:coverage>Worldwide</dc:coverage>
</metadata>
<manifest>
<item href="cover.jpg" id="My_Cover_ID" media-type="image/jpeg" />
<item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml" />
<item href="coverpage.html" id="htmlcoverpage" media-type="application/xhtml+xml" />
<item href="content001.html" id="htmlcontent001" media-type="application/xhtml+xml" />
<item href="htmltoc.html" id="htmltoc" media-type="application/xhtml+xml" />
<item href="content002.html" id="htmlcontent002" media-type="application/xhtml+xml" />
<item href="bbstylesheet-epub.css" id="cssbbstylesheet-epub" media-type="text/css" />
<item href="myimage.jpg" id="img1" media-type="image/jpeg" />
</manifest>
<spine toc="ncx">
<itemref idref="htmlcoverpage" />
<itemref idref="htmlcontent001" />
<itemref idref="htmltoc" />
<itemref idref="htmlcontent002" />
</spine>
<guide>
<reference href="coverpage.html" type="cover" title="Cover" />
<reference href="htmltoc.html" type="toc" title="Table of Contents" />
<reference href="content002.html" type="text" title="Beginning" />
</guide>
</package>
toc.ncx file
This XML file specifies the NCX Table of Contents. Ensure that the playOrder attribute is numbered sequentially. Thankfully, this bloated format is going away with EPUB 3.
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="en">
<head>
<meta content="urn:uuid:3e3f969b-c287-4327-bcdd-4f7eda7c9411" name="dtb:uid" />
<meta content="1" name="dtb:depth" />
<meta content="0" name="dtb:totalPageCount" />
<meta content="0" name="dtb:maxPageNumber" />
</head>
<docTitle>
<text>Crime and Punishment</text>
</docTitle>
<docAuthor>
<text>Fyodor Dostoevsky</text>
</docAuthor>
<navMap>
<navPoint id="ncxcoverpage" playOrder="1">
<navLabel>
<text>Cover</text>
</navLabel>
<content src="coverpage.html" />
</navPoint>
<navPoint id="ncxcontent001h1-1" playOrder="2">
<navLabel>
<text>Chapter 1</text>
</navLabel>
<content src="content001.html#h1-1" />
</navPoint>
<navPoint id="ncxcontent002h2-1" playOrder="3">
<navLabel>
<text>Chapter 2</text>
</navLabel>
<content src="ontent002.html#h2-1" />
</navPoint>
</navMap>
</ncx>