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 http://www.helenhanson.com/?p=1318 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">
<metadata>
<dc-metadata xmlns:dc="http://purl.org/metadata/dublin_core" xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0/">

<dc:Title>YOUR TITLE</dc:Title>
<dc:Language>en-us</dc:Language>
<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>

</dc-metadata>

<x-metadata>
/* <output encoding="Windows-1252" content-type="text/x-oeb1-document"></output> */
<output encoding="utf-8" content-type="text/x-oeb1-document"></output>
<EmbeddedCover>YOURCOVER.jpg</EmbeddedCover>

<SRP Currency="USD">0.99</SRP>
<Demo>YOURFILENAMESample.prc</Demo>
</x-metadata>

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

</metadata>

<manifest>
<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>
</manifest>

<spine toc="toc">

<itemref idref="item1"/>

</spine>

<tours></tours>

<guide>
<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>

</guide>

</package>

No comments:

Post a Comment