28 thoughts on “Creating eBooks: An ePub Tutorial”
I’m really impressed by the tutorial and the amount of work you have to put into creating even simplest ebook. I’ve never realized it’s so complicated and time consuming process, since I use Mobipocket Creator, free tool which simplifies this process enormously. Unfortunately, Windows-only. http://www.mobipocket.com/en/DownloadSoft/ProductDetailsCreator.asp
Hello Wasaty,
I use Mobipocket Creator as well. Just for Mobipocket books, though; it can’t generate ePub.
It’s the magic of Crossover for Mac that lets me run that Windows app.
And addendum: Most of the time I spend creating an ebook, whether I’m going to produce ePub, Mobipocket Creator, or something else, I spend in the neighborhood of 90% of my time fiddling with formatting and breaking up files, adding captions to images, etc.
It’s required to have a ‘toc’ attribute on the spine element. The value of this element should be the ID of the NCX file.
“If a Publication includes an NCX, the item that describes the NCX must be referenced by the spine toc attribute.”
epubcheck doesn’t currently complain about it, but it should — there’s an error in the official OPF schema. This is in the process of being corrected.
Hi Liza,
Thanks for the heads up! I’ve updated the basic metadata.opf section as well as the sample epub file.
Actually for dc:creator it should be “firstname lastname” and you can use the opf:file-as attribute on dc:creator to set “lastname, firstname”. You can also use an opf:role value on the dc:creator property.
Thanks, Hadrien. The tutorial section and the EPub have both been updated.
Awesome tutorial. Thank you.
Thanks so much for posting this! … I’ll come back with some silly questions later in the week. Keep up the great work. … MP
Wow. This is pretty complex. Even starting with text in ASCII format. Taking scans off the printed page would just be a beast to tackle!
Great job on your tutorial. Thanks for taking the time to create and post it!
Seth
Hi ,
I downloaded few epub books from “http://www.epubbooks.com/books” ,
when i renamed the .epub extension to .zip and tried to unzip them,
then they are not getting unzipped ,
What might be the problem ?
any suggestion is welcomed.
Thanks..
Hello Biranchi,
I don’t know what the problem could be. File corruption, maybe, but I’m not sure.
Sorry I can’t be of more help. :(
Some things that I had to scratch my head over –
Does the mime type need a newline after it?
In META-INF/container.xml, I think but am not sure that full-path is relative to the root of the distro, so there’s an implied META-INF/.. . For example, the following is the correct full path for the metadata.opf in the parent of META-info:
Are these two IDs the same?
metadata.opf: foo
toc.ncx:
Hello Lucas!
There’s a newline at the end of the mime type for the books I’ve created, but I don’t know if it’s necessary or not.
Yup, the full-path is indeed relative to the root of the distro.
I’m not sure which IDs you’re referring to?
I tried out MIMETYPE with and without a newline and epubcheck didn’t complain either way. I tested a no -newline version on Adobe’s reader it opened fine.
For full-path I tested with ./ as a prefix and found that epubcheck couldn’t process it, even though it’s legal.
The IDs got munged up during posting because I included XML. The question is what the difference is between dc:identifier in the .opf file and meta name=”dtb:uid” in toc.ncx.
Lucas,
Epubcheck isn’t infallible unfortunately, and has bugs. It’s a google code project, and so people can file bugs/ask questions.
I don’t know what the difference between dc:identifier and dtb:uid, but it’s probably a good idea to make them match up. Different reader implementations will latch onto one or the other to ID texts.
Maybe of interest: I just wrote a how-to on creating e-pub books with Sigil. I referenced this post as a must read back ground text before even beginning the wysiwyg route. :-)
There are tutorials for hand-creating Kindle (.mobi), and iPad (ePub) files on http://www.katiebooks.ca
Most of the code necessary can be copied and new titles, authors, etc inserted.
Have a look!
I would like to make ePub books with custom content, including video on some pages. Is there a tutorial for creating that?
Could I make books directly in some ePub software, or would I always need to convert using this tutorial?
Most importantly, could I make ebooks that do the cool page turning thing on my iPad?
“Page turning thing” is a feature of the ebook reader, not the ebook itself.
Have you written any scripts that do this automatically with xslt or perl? I’m in the process of writing a DITA to ePub transformation. I’ve seen other examples that use XPointers. I was wondering if you messed with XPointer references dynamically.
where can i get the epub demo files
Read the introduction.
It’s not going to be complicated; it just contains the single line:
application/epub+zip
It should have no suffix at all (e.g., it should just be called “mimetype”, not “mimetype.txt”) nor extra spacing or empty lines.
I’m really impressed by the tutorial and the amount of work you have to put into creating even simplest ebook.
this is an awesome tutorial, thanks for that…
how to link them within the file, for example if i want to link a table of chapter 2 from chapter 1, is that a normal html method or should i need to do something different in epub?
give full name of the ncx of epub.
Thank you so much for this tutorial. It has been a life saver, after weeks battling with my .epub conversion. You clearly put a lot of work into it. There are hardly any other places (at least that I can find with google) that go into such detail. Thanks!
I cannot get Windows 7 to create my files as anything other than TXT files
I’m really impressed by the tutorial and the amount of work you have to put into creating even simplest ebook. I’ve never realized it’s so complicated and time consuming process, since I use Mobipocket Creator, free tool which simplifies this process enormously. Unfortunately, Windows-only.
http://www.mobipocket.com/en/DownloadSoft/ProductDetailsCreator.asp
Hello Wasaty,
I use Mobipocket Creator as well. Just for Mobipocket books, though; it can’t generate ePub.
It’s the magic of Crossover for Mac that lets me run that Windows app.
And addendum: Most of the time I spend creating an ebook, whether I’m going to produce ePub, Mobipocket Creator, or something else, I spend in the neighborhood of 90% of my time fiddling with formatting and breaking up files, adding captions to images, etc.
It’s required to have a ‘toc’ attribute on the spine element. The value of this element should be the ID of the NCX file.
See here in the spec:
http://openebook.org/2007/opf/OPF_2.0_final_spec.html#Section2.4.1
“If a Publication includes an NCX, the item that describes the NCX must be referenced by the spine toc attribute.”
epubcheck doesn’t currently complain about it, but it should — there’s an error in the official OPF schema. This is in the process of being corrected.
Hi Liza,
Thanks for the heads up! I’ve updated the basic metadata.opf section as well as the sample epub file.
Actually for dc:creator it should be “firstname lastname” and you can use the opf:file-as attribute on dc:creator to set “lastname, firstname”. You can also use an opf:role value on the dc:creator property.
Thanks, Hadrien. The tutorial section and the EPub have both been updated.
Awesome tutorial. Thank you.
Thanks so much for posting this! … I’ll come back with some silly questions later in the week. Keep up the great work. … MP
Wow. This is pretty complex. Even starting with text in ASCII format. Taking scans off the printed page would just be a beast to tackle!
Great job on your tutorial. Thanks for taking the time to create and post it!
Seth
Hi ,
I downloaded few epub books from “http://www.epubbooks.com/books” ,
when i renamed the .epub extension to .zip and tried to unzip them,
then they are not getting unzipped ,
What might be the problem ?
any suggestion is welcomed.
Thanks..
Hello Biranchi,
I don’t know what the problem could be. File corruption, maybe, but I’m not sure.
Sorry I can’t be of more help. :(
Some things that I had to scratch my head over –
Does the mime type need a newline after it?
In META-INF/container.xml, I think but am not sure that full-path is relative to the root of the distro, so there’s an implied META-INF/.. . For example, the following is the correct full path for the metadata.opf in the parent of META-info:
Are these two IDs the same?
metadata.opf: foo
toc.ncx:
Hello Lucas!
There’s a newline at the end of the mime type for the books I’ve created, but I don’t know if it’s necessary or not.
Yup, the full-path is indeed relative to the root of the distro.
I’m not sure which IDs you’re referring to?
I tried out MIMETYPE with and without a newline and epubcheck didn’t complain either way. I tested a no -newline version on Adobe’s reader it opened fine.
For full-path I tested with ./ as a prefix and found that epubcheck couldn’t process it, even though it’s legal.
The IDs got munged up during posting because I included XML. The question is what the difference is between dc:identifier in the .opf file and meta name=”dtb:uid” in toc.ncx.
Lucas,
Epubcheck isn’t infallible unfortunately, and has bugs. It’s a google code project, and so people can file bugs/ask questions.
I don’t know what the difference between dc:identifier and dtb:uid, but it’s probably a good idea to make them match up. Different reader implementations will latch onto one or the other to ID texts.
Maybe of interest: I just wrote a how-to on creating e-pub books with Sigil. I referenced this post as a must read back ground text before even beginning the wysiwyg route. :-)
http://www.noisepollution.nl/?p=2015
Thanks for your great run through.
There are tutorials for hand-creating Kindle (.mobi), and iPad (ePub) files on http://www.katiebooks.ca
Most of the code necessary can be copied and new titles, authors, etc inserted.
Have a look!
I would like to make ePub books with custom content, including video on some pages. Is there a tutorial for creating that?
Could I make books directly in some ePub software, or would I always need to convert using this tutorial?
Most importantly, could I make ebooks that do the cool page turning thing on my iPad?
Eric,
You should probably look at Sigil.
“Page turning thing” is a feature of the ebook reader, not the ebook itself.
Have you written any scripts that do this automatically with xslt or perl? I’m in the process of writing a DITA to ePub transformation. I’ve seen other examples that use XPointers. I was wondering if you messed with XPointer references dynamically.
where can i get the epub demo files
Read the introduction.
It’s not going to be complicated; it just contains the single line:
application/epub+zip
It should have no suffix at all (e.g., it should just be called “mimetype”, not “mimetype.txt”) nor extra spacing or empty lines.
I’m really impressed by the tutorial and the amount of work you have to put into creating even simplest ebook.
this is an awesome tutorial, thanks for that…
how to link them within the file, for example if i want to link a table of chapter 2 from chapter 1, is that a normal html method or should i need to do something different in epub?
give full name of the ncx of epub.
Thank you so much for this tutorial. It has been a life saver, after weeks battling with my .epub conversion. You clearly put a lot of work into it. There are hardly any other places (at least that I can find with google) that go into such detail. Thanks!
I cannot get Windows 7 to create my files as anything other than TXT files