Filed under: en/General
I have been using Mobipocket reader on Symbian, but there is no iPhone version. I found Stanza a good alternative, and perhaps better. It uses epub format. epub is an open standard. Here is how to create epub file by hand (partly from http://www.jedisaber.com/eBooks/tutorial.asp).
A .epub file contains, at a bare minimum, the following files/folders:
* mimetype – tells a reader/operating system what’s in here
* META-INF folder – This folder contains, at minimum, the container.xml file, which tells the reader software where in the container to find the book.
* OEBPS folder – Recommended location for the books content. It contains:
o images folder – images go here
o Content.opf – XML file that lists what’s in the container
o toc.ncx – This is the table of Contents
o xhtml files – The book’s contents are in these
Lets look at each of these in more detail.
One thing to note before we get started: the filenames are case sensitive. This means that if you have a file named “Chapter1.xhtml” and you refer to it as “chapter1.xhtml” in the .OPF file or .NCX file, the book will not display properly.
mimetype
This file is just a plain ASCII text file that contains the line:
“application/epub+zip”
The operating system can look at this file to figure out what a .epub file is instead of using the file extension. This file must be the first file in the zip file, and must not be compressed.
META-INF Folder
This contains the container.xml file, which points to the location of the Content.opf file. This folder is the same for every e-book, so you should be able to recycle the whole folder from the sample file without making changes.
OEBPS Folder
- images Folder
If you have any images for your eBook, they go in here.
- Content.opf
This file gives a list of all files in the .epub container, defines the order of files, and stores meta data (author, genre, publisher, etc.) information. Note that this file can be named anything you want to call it, as long as the container.xml file mentioned above points to the correct filename.
Lots of stuff in this file. I’ll go through each required tag here. Check the specs to see more information about optional meta data tags.
dc:title – Title of the book
dc:language – Identifies the language used in the book content. The content has to comply with RFC 3066. List of language codes. (I’d just copy the language tag from the sample…)
dc:identifier – This is the book’s unique ID. This has to be a unique identifier for every different e-book. The spec doesn’t give any sort of recommendation for what to use, but an ISBN number would be a good bet. I used the name of my web site and the date and time.
One thing to note, because of how the file interacts with toc.ncx, just modify what’s after the ” uuid:” on this line.
Next comes the manifest. This is just a listing of the files in the .epub container, and their file type.
Each item is also assigned an item ID that’s used in the spine section of content.opf. This list does not have to be in any particular order.
The spine section lists the reading order of the contents. The spine doesn’t have to list every file in the manifest, just the reading order. For example, if the manifest lists images, they do not have to be listed in the spine.
- toc.ncx
This is the table of contents. This file controls what shows up in the left Table of Contents pane in Digital Editions
Things you need to change:
- Make sure the uid matches what you have in content.opf
- doctitle: The text inside the text tag is what will show up as the books title in the reader software
- The navpoint tag.
Each nav point is a chapter listing, the text is the chapter name, and the src is the file it links to.
If you copy a navpoint tag set to add chapters, make sure to update the id and playorder values.
Notes:
According to the spec, the ID can be anything you want, but it’s easier to keep track of things if you use the same ID you used for that file in the .OPF file. Also, some readers won’t properly display the Table of Contents if the ID doesn’t match.
Also, the playorder values have to be in order. (An item with playorder 1 will be before an item with playorder 2, etc.) They also have to be listed in order, and can’t have any gaps. (You’ll get an error if you jump from 1 to 20, etc)
Note: You can use a .css style sheet file to layout styles for your book as well. Just make sure to list it in the manifest section of Content.opf
Also of note here, any styling should be done in a CSS stylesheet, and not in the document.
- Content .xhtml files
Content files should be XML 1.1 documents
If you’re not familiar with XML, it’s basicly HTML with closing tags for every element, and several style tags are not supported.
As far as how to put the content, you can have it all in one document with bookmarks at each chapter, or each chapter in a seperate .xhtml file. The latter looks nicer in most readers.
Making the Container
Run this command inside the directory (change etq109 to the file name of the resulting epub file)
zip -v0X etq109 mimetype; zip -vr etq109 * -x etq109.zip mimetype; mv etq109.zip etq109.epub
The zip file layout should look something like this:
- mimetype
META-INF
– container.xml
OEBPS
images
– content.opf
– toc.ncx
– stylesheet.css
– content.xhtml
You should now be able to open your eBook in Adobe Digital Editions, or any other reader that supports the .epub format.
epub specification
http://www.idpf.org/specs.htm
Filed under: en/Mobile
Some months ago, my SoftBank cellphone was destroyed when I forgot to take it out from my trousers’ pocket and it was washed by the washing machine. It’s time now to get a replacement. I wanted a cellphone that has standard Japanese features (e.g., 1seg, Felica, quality still and video camera), WiFi and is a smartphone. It turned out to be impossible to get all of these in one unit. I was of course interested in the iPhone, but it is so non-Japanese that it would be painful to use it in Japan, so I decided on a HTC Touch Diamond, but when I tried it, I immediately recalled my experience of using a Windows Mobile phone, it was really painful. I was a Windows mobile user twice, first when it was still PocketPC, and then Windows Mobile 5. HTC Touch Diamond uses Windows Mobile 6, but basically nothing has changed, it is still a bad idea. I then reluctantly picked the next choice, the iPhone 3G. Other than that it surprisingly failed to connect to my WiFi router (while the MacBook Pro had no problem at all), it could not connect to the Mac via Bluetooth for file exchange, and no wireless syncing, it was truly a great smartphone. Apple has really done what no other smartphone company could have done so far. I am also a Blackberry user when abroad, about the only thing that I sometimes miss from a Blackberry is its hardware keyboard. It seems that now the only way for faster typing is really using a hardware keyboard. I won’t be surprised if Apple later invent an equivalent for this, but now the software keyboard is no match for hardware keyboard for heavy keyboard use. Anyway, iPhone is really marvelous. I have used different kinds of handsets, iPhone really stands out in term of usability and functionality.


