View Full Version : ePub Preview

10-06-2011, 08:13 PM
I want to create an ePub preview of my book on

I looked at the sample ePub file of my book from the ibookstore on my iPod, but there is no way to drag it onto my desktop.

I tried simply removing all but 4 chapters from the text folder, but that seems to create errors.

So, how can create an ePub containing a few sample chapters?


10-06-2011, 11:19 PM
When you delete the chapters, you also have to remove the references to those files from the content.opf and toc.ncx files. You can edit them with any text editor.

The content.opf file is the manifest that has all the info about the files contained in the book, it should have two lines for every chapter, one in the <manifest> section that will look something like this <item href="Text/chapter04.xhtml" id="chapter04" media-type="application/xhtml+xml" />, one in the <spine> section that will look something like this <itemref idref="chapter04" />, you need to delete both lines for every chapter. Also any images used only in the deleted chapters will also need to be deleted from the epub and the <manifest> section.

The toc.ncx is the table of contents for the book, this is what allows you to select a chapter from your reader menu, there is a section for every item in the table of contents that starts with <navpoint id="navpoint-something" playOrder="something"> and ends with </navpoint> delete everything between and including those two tags for every chapter deleted.

Also you could use Sigil to delete the chapters and it will automatically update the content.opf file, and you can do the editing of the toc.ncx in Sigil.

10-07-2011, 01:01 AM
Thank you for the helpful and detailed information.

10-07-2011, 01:02 PM
You could also replace the chapters with a dummy chapter that contains no actual content. This solution would be useful if you want the sample to show the names of all the chapters which is useful on a technical eBook.

While the submitter cannot do it there is also a way to place DRM on some files but not others permitting the same book to be both a sample and a full book.


10-07-2011, 02:24 PM
Thanks for this tip, too

10-08-2011, 04:05 PM
I tried making sample chapters with a bit of text for buyers to see, but when validating, I get these errors for each chapter involved. Here's a sample:

1. ERROR: preview_empowered_10_8_11.epub: could not parse OEBPS/Text/05_chapter.xhtml: duplicate id: heading_id_3
2. ERROR: preview_empowered_10_8_11.epub: could not parse OEBPS/Text/06_chapter.xhtml: duplicate id: heading_id_3
3. ERROR: preview_empowered_10_8_11.epub: could not parse OEBPS/Text/07_chapter.xhtml: duplicate id: heading_id_3

How would fix this?


10-09-2011, 02:02 PM
You probably have some duplicate names in your ePUB. If you are running Sigil, please recreate the TOC from the headers, that should solve your issues.
You can do it manually by changing the id's in the header tags. It is not that hard, but you need to check your opf also then.

10-09-2011, 03:28 PM
Recreating the TOC in Sigil creates another error:

1. ERROR: test_preview_empowered_10_8_11.epub/OEBPS/toc.ncx(92): assertion failed: different playOrder values for navPoint/navTarget/pageTarget that refer to same target

Going back to the original error:

1. ERROR: preview_empowered_10_8_11.epub: could not parse OEBPS/Text/05_chapter.xhtml: duplicate id: heading_id_3

Here is the code. Where is the error?

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<html xmlns="">
<title>An Artist Empowered</title>
<link href="../Styles/template.css" rel="stylesheet" type="text/css" />
<link href="../Styles/page-template.xpgt" rel="stylesheet" type="application/vnd.adobe-page-template+xml" />
<style type="text/css">

p.sgc-4 {margin-top: 0.4em; margin-bottom: 1.2em; page-break-inside: avoid; text-indent: 0px; font-size: 11px; text-align: left; margin-right: 0em; margin-left: 2em;}
p.sgc-3 {margin-top: 1em; margin-bottom: 0.1em; page-break-inside: avoid; text-indent: 0px; font-style: italic; text-align: left;}
h1.sgc-2 {font-size: 17px; text-align: left; color: rgb(0, 153, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0.5em; margin-left: 1em;}
span.sgc-1 {font-weight: normal; text-transform: none; font-size: 14px;}

div.sgc-7 {font-size: 120%}
span.sgc-6 {font-size: 120%}
span.sgc-5 {font-size: 14px}

h3.sgc-10 {font-size: 120%}
span.sgc-9 {font-size: 14px;}

span.sgc-11 {font-size: 17px;}

<div id="x05-chapter">
<h1 class="chaptertitle" id="toc-anchor"></h1><span class="sgc-1">5: A NEW POSTER CHILD</span>

<h1 class="chapter-subhead sgc-2" id="heading_id_2"><span class="sgc-1">Artist as Hero</span></h1>

<p class="sidebar-quote-sj1 sgc-3"><span class="sgc-1">The act of rejection, as well as acceptance, is based on subjective criteria and has nothing to do with your value as an artist, or as a human being.</span></p>

<p class="sidebar-author sgc-4"><span class="sgc-1">CAROLL MICHELS</span></p>

<p class="sidebar-author sgc-4"><span class="sgc-1"><br /></span></p>

<p class="sidebar-author sgc-4"></p>

<h3 class="sidebar-author sgc-4" id="heading_id_3"></h3><span class="sgc-1 sgc-6">Buy the complete book: print or&nbsp;</span><span class="sgc-11">eBook</span>

<h3 class="sidebar-author sgc-4" id="heading_id_3"><span class="sgc-1 sgc-6">An Artist Empowered: Define and Establish Your Value as an Artist&mdash;Now</span></h3>

<h3 class="sidebar-author sgc-4 sgc-10" id="heading_id_3"><span class="sgc-9">By Eden Maxwell</span></h3>

<h3 class="sidebar-author sgc-4 sgc-10" id="heading_id_3"><span class="sgc-9">“Eden Maxwell’s art is brilliant; he’s the real thing, a true creator.”&nbsp;</span></h3>

<h3 class="sidebar-author sgc-4 sgc-10" id="heading_id_3"><span class="sgc-9">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&mdash;Mary Anne Bartley, Artist-in-Residence: Villanova University, WHYY, PBS</span></h3>

<div class="sgc-7">
<br />

10-09-2011, 07:30 PM
Do a search on id= and you will find that you have several with heading_id_3. That is what duplicate means. you cannot repeat an id within the same file or you will have a duplicate.

10-10-2011, 04:14 PM
I went into the code and fixed those duplicates on all my chapters with Sigil. The ePub did pass the validation on Threepenny consulting website.

But when I upload this file to, I get another error message.

How to I fix this?

Jim Lester
10-10-2011, 06:29 PM
That sounds like it is complaining about the metadata section of your packaging file (the .opf file). What does it look like (look for the dc:creator and dc:date elements).


10-10-2011, 06:50 PM
I see this: <dc:creator opf:role="aut">Eden Maxwell</dc:creator>

But I don't see dc:date, or date?

Jim Lester
10-11-2011, 12:55 AM
dc:date is a required element, so you'll want to add that.
Also is there an opf namespace definition in your metadata element?

10-11-2011, 01:59 PM
I've attached the OPF in question, as this may be easier than me guessing what to do and how.


Jim Lester
10-11-2011, 03:38 PM
You sent it as an RTF file, instead of the raw text. I'm assuming that happened after extraction from the epub rather than before - or I would expect to see different validation errors - but you may want to check just in case.

Edit: Outside of it being RTF, I didn't see anything obvious in the file that would fail validation.

10-11-2011, 03:47 PM
I unzipped the ePub file. Here is the opf. I presume this is the form you are asking for.

10-12-2011, 03:57 AM
The message does not say the ePub is not valid, just that B&N might reject it, and we don't know the requirements they have, but guessing:

They want a <dc:date> element. It is not compulsory by the spec, but it makes sense they want a date.

They want a opf:file-as attribute in the <dc:creator>, or they want the author names formatted as "Last-name, First-name", or something similar.

10-12-2011, 01:57 PM
When I uploaded my original ePub to B&N, there was no error, or rejection.

The error message has occurred when trying to upload the preview version to Other than making sample dummy chapters, I haven't changed anything in the opf file--that I'm aware of.

I don't know how to add a correct <dc:date> element, or what format for the author's name.