ePub is one type of eBook format. It is an open standard and it is supported by a large proportion of devices.
Technically, an ePub file is a .zip file which means it is a single compressed file of many other files that make up the eBook including the text, images, media etc
The actual layout of the book is xhtml which means that an ePub file is really a compressed type of website that the software can display as your eBook. this is important for a few reasons.
When you are laying out your initial eBook, you do that more like you would a website that say a PDF or newsletter. There aren’t any pages in the ePub format because every reader is different and people like the font size certain ways. The text must therefore be flowing to allow for this.
Secondly, when it comes time to add media or do any manual editing, you will notice that certain files need to be in the right folders and you have to unzip and zip the contents.
Writing the eBook
You simply write the ebook like you would any other document. You can use a word processor, cut and paste and all the other features. You can even use Notepad, or any simple text editor. The only real difference is that you should not add any formatting to the initial file. No need to add bold, underline, change font sizes for headings etc at this stage.
You can add images where you need them however you should treat formatting very simply. The eBook will display images without wrapping and in the centre generally. Resize your images as if for the web. I suggest 800px maximum. All images are included in the ePub file so any space you can save keeps the final file size down.
You can add hyperlinks now if you like but they can also be added later.
Converting to ePub format
Download and install Calibre which is an eBook conversion and management tool.
Now find the ebook file you have made in Open Office, Google Docs or whatever you used and simply drag it into Calibre. It should add it to its list of eBooks but it hasn’t converted it yet.
First you should edit the metadata which is the information about the book such as author, year of composition, publisher etc. Simpy select the book and hit the “Edit Metadata” button. Fill in the blanks as required.
Now select your book and use the convert button to open a dialogue window. Choose ePub as your format and there are many options you can play with. I used all the defaults. At this point you will want to add your cover image. Simply choose a jpg, gif or png file on this page before hitting ‘convert’.
After a second of processing it will complete.
I then exported the ePub to somewhere that I could find it (like your desktop) by selecting the ePub and clicking the large “Save to Disk” button.
So now you have a fairly plain, unformatted ePub file. It will open now on an eReader and work just fine. All we are doing from here is cosmetic and improving the user experience.
Fine Tuning the ePub
Download and install Sigil which is an ePub editor.
Open the epub that you just saved from Calibre. Now you can begin the extra formatting adding headings, and moving images that are misplaced. You can add images, links and text decoration here.
You will notice that rather than designating font sizes etc here you are taking a more web-like style sheet approach and naming them Heading1, Heading 2 etc from the Format dropbox. Normal text is ‘normal’ in that list.
Once again you can do a lot of editing here until you get it just right.
Next step while in Sigil is to generate the Table of Contents. This can be done automatically based on the Heading levels you have chosen. Once you understand this you can choose the right formatting to control your eBook structure. To generate this structure hit the button in the bottom left called “Generate TOC from Headings”.
Now you have a much better looking eBook with a table of contents.Save the file and you have a finished product.
Adding Video and Audio using HTML5
This bit is the trickiest bit by far! I got a lot of help from this blog.
Remember how I said that epub files were really zip files. Well you need to remember that here.
Before you do this, take a backup of your ebook which is now finished without any media in it.
Now rename the ePub file you have made from ****.epub to ****.zip … and then unzip the file to a known location. Go and have a look and you will see many files and folders there. That is your ebook in a raw state and we are about to go play in it.
Now to convert your video to mp4. I only made mine about 480x320 pixels. Also convert your audio to MP3 or similar.
Next create a folder in ****/OEBPS/Text/ folder in your ebook called video and another called audio while we are at it. Copy your video into the video folder and audio into the audio folder.
Now open the main xhtml file in the ****/OEBPS/Text/ directory (it should look something like Section0001.xhtml). You will see your html of your ebook. Find where you want the video to appear in the book and add this code where the video is the name of your video …
<video src=”video/testvideo.mp4? controls=”true” width=”320? height=”240? autoplay=”false”>This is an introductory video</video>
The audio player code is:
<audio src=”video/testvideo.mp4? controls=”true” autoplay=”false”>This is an introductory audio</audio>
Now you have to add a reference to those files in another file called content.opd in the OEBPS directory. Simply add this line before the </manifest> tag:
<item id=”video1? href=”video/testvideo.mp4? media-type=”video/mpeg4? />
<item id=”audio1? href=”video/testaudio.mp3? media-type=”video/mpeg3? />
Now, zip all the files together again and then rename it to the .epub extension and you are ready to test your ebook!
If you have an Apple device you will need to drag the file to itunes and it will add it to your Books ...then sync to your device.
Alternatively you can email the file to yourself and click the attachment in the email. The device will ask if you want to open it in iBooks.