Monday, February 20, 2012

Kindle Formatting 5: Preparing the OPF file

NOTE: There is an error in this OPF file that causes the Table of Contents to not be recognized. Please see #7 in this series where I explain where the entries should go.
Related thread in Amazon Forum.

Helen Hanson does a great explanation of the OPF file.

Everyone's file will be different because of content. In this example, YOURFILENAME=mynovel and YOURCOVER=mycover [make sure these two files are in your sandbox. Move the toc.ncx and this opf file which is named YOURFILENAME.opf or mynovel.opf into the sandbox]

The toc.htm will not be found. I could not figure out how to do this, so before we move on, delete your table of contents from YOURFILENAME.htm. Simple delete all rows starting with <p class=MsoToc1 ...
Or go into your mynovel.docx and delete the Table of Contents and regenerate the mynovel.htm. This is probably better since the entire purpose of this exercise is to be able to keep changing mynovel.docx and regenerate mynovel.htm without having to regenerate the toc.ncx file. This allows you to fix typos, etc.

<?xml version="1.0" encoding="utf-8"?>
<package unique-identifier="uid">
<dc-metadata xmlns:dc="" xmlns:oebpackage="">

<dc:Title>YOUR TITLE</dc:Title>
<dc:Identifier id="uid"></dc:Identifier>
<dc:Creator>YOUR NAME</dc:Creator>
<dc:Publisher>YOUR PUBLISHER</dc:Publisher>
<dc:Subject BASICCode="FIC027050">Romance/Historical</dc:Subject>
<dc:Description>YOUR PRODUCT DESCRIPTION</dc:Description>

<dc:Date>YOUR PUB DATE</dc:Date>


/* <output encoding="Windows-1252" content-type="text/x-oeb1-document"></output> */
<output encoding="utf-8" content-type="text/x-oeb1-document"></output>

<SRP Currency="USD">0.99</SRP>

<meta name="cover" content="my-cover-image" />


<item href="YOURCOVER.jpg" id="my-cover-image" media-type="image/jpeg" />
<item id="toc" media-type="application/x-dtbncx+xml" href="toc.ncx"></item>
<item id="item1" media-type="text/x-oeb1-document" href="YOURFILENAME.htm"></item>

<spine toc="toc">

<itemref idref="item1"/>



<reference type="toc" title="Table of Contents" href="toc.htm"/>

<reference type="cover" title="Cover Image" href="YOURFILENAME.htm%23cover"></reference>
<reference type="toc" title="Table of Contents" href="YOURFILENAME.htm%23toc"></reference>
<reference type="start" title="Startup Page" href="YOURFILENAME.htm%23start"></reference>



No comments:

Post a Comment