Advertisement
  1. Code
  2. iOS SDK
Code

iBooks Bootcamp: Getting Started

by
Difficulty:BeginnerLength:QuickLanguages:
This post is part of a series called iBooks Bootcamp.
iBooks Bootcamp: Fixed Layout Project Setup

The publishing industry has been revolutionized by technological advances that make it easier than ever for authors to self-publish their work. One of the best options for self-publishing today is Apple's iBooks platform. This tutorial series will take you from zero-to-hero with iBooks by showing you how to create fixed-layout, flowing, and multi-touch e-books. Prior experience with web languages like CSS, JavaScript, and HTML is helpful when creating iBooks, but no prior knowledge is necessary to complete these tutorials.


What are iBooks?

You have most likely heard of digital books, sometimes referred to as Electronic Publications or EPUBs, as they have been gaining in popularity for many years. The EPUB global governing body is the International Digital Publishing Forum (IDPF). The IDPF provides a specific set of standards for the EPUB format. In 2010, Apple launched the iBooks app, an iPad app that brought readers an Apple version of digital books based on EPUB (iBooks is now available for all iOS devices). Over time, Apple has added and improved iBooks to include advanced features like Fixed Layout and Read Aloud.

Screenshot: bookshelf of iBooks app with a few books on the shelf

What is a Fixed Layout iBook?

The location of the text and images on each page of a Fixed Layout iBook is given a specific location in which to appear. No matter what iOS device you view it on, the book lays out the same way each time. Each page of a Fixed Layout iBook is coded in a separate XHTML file and has a set of CSS styles that define its layout. Fixed Layout iBooks provide the most control over an iBook, and, consequently, are the most labor intensive to create!

Screenshot: a Fixed Layout iBook

Other Types of iBooks

A Fixed Layout iBook is great for a 20-page children’s picture book, but it isn’t always the best type of iBook to use. Imagine coding a separate XHTML file and positioning all the text for a 250-page novel! That is definitely not ideal. In certain cases, you may want to consider a different type of iBook.

Flowing Books

Flowing books are just like they sound; the text on the page will flow to the next page if there isn’t enough room. The location of the text on a specific page isn’t guaranteed. The nice thing about Flowing books is that they can be created using a variety of programs. Even Pages will save your file as an EPUB. Flowing books are generally ideal for text-heavy books, such as novels, where a specific location for text or image placement isn’t necessary.

Screenshot: a Flowing Text iBook

Multi-Touch Books

Multi-Touch books are a specific type of interactive book created using Apple’s iBooks Author program. Multi-Touch iBooks are often text books, although any type of book can be created using iBooks Author and thus deemed a Multi-Touch iBook.

Screenshot: a Multi-Touch iBook

Getting Started with Apple

Becoming an iBooks Content Provider

Before you can upload free or paid books to the iBookstore, Apple’s storefront for selling iBooks, you will need to set up an account with Apple. Start by going to the Apple Content Provider Application site. Click the blue button at the bottom of the page to get started and follow the directions on each page to complete the application.

Free or Paid Account

You will need to choose between a free account and a paid account based on whether you plan to sell your books or give them away for free. If you plan to sell your books at some point in the future, you may want to get a paid account now. You can still offer free books with a paid account, and it is easier to be set up with a paid account from the start. If you are applying for a paid account, be sure to have a valid US tax id and bank routing and account numbers before beginning the application. Be prepared to wait for acceptance until Apple verifies your information. Once your application is accepted by Apple, you will be able to log in to iTunes Connect where you will find various documentation and programs available for download to assist you in producing an iBook.


Development Tools and Environment

Text Editor

There are a few development tools you will need to create an iBook. A good text editor is essential in speeding up the coding process. There are many free text editors available for download, and everyone seems to have a favorite. Two commonly used, free editors include Komodo Edit and Text Wrangler.

Screenshot: Komodo Edit interface

Terminal or a Command-Line Tool

Fixed Layout and Flowing Text books can be zipped into an EPUB file using Terminal or another command-line tool. For this series of tutorials, we will be demonstrating how to zip EPUB files using Terminal.

iTunes

You will need a recent version of iTunes in order to upload an iBook from your computer to a device. While there may be a better computer-to-device solution for approved iBooks Content Providers, we’re going to stick with using iTunes in this tutorial since it is available to everyone.

iOS Device

While it is possible to view each XHTML page of an iBook in Safari, there are also potential bugs that won’t show up in Safari that you will find when testing your book on a device in iBooks. Safari is great for quickly checking whether text or an image is correctly placed, but you will want to have an iOS device with iBooks installed for testing the book before uploading to the iBookstore.

Mac Computer

Although not required to code an iBook, you will need a Mac in order to upload your iBook to the iBookstore. This tutorial will provide instruction based on working in a Mac environment.


Filetypes

There are a variety of filetypes that work together to create a valid EPUB or iBook. Some filetypes you may recognize and some may be completely foreign. Let's take a look at each type of file you will encounter and talk about its purpose.

Mimetype

A mimetype file is used regularly in the computer world to specify file types. In this case, the mimetype file is accessed by the iBooks app before anything else and it is used to determine how the book is configured.

OPF File

This file holds a reference to every piece of content in your iBook. From XHTML files to image files to sound and embedded fonts, it is all required to be listed in the .opf file. Additionally, the .opf file lists the order in which the pages should appear, defines the major sections of the book, and holds the book’s metadata, such as author, copyright holder, genre, and publishing date.

com.apple.ibooks.display-options.xml

This XML file allows you to specify certain characteristics of your iBook. Some of the options include whether the iBook is Fixed-Layout, if the book contains embedded fonts, and whether to lock the orientation in landscape, portrait, or not at all.

Container.xml

Also an XML file, the container file tells iBooks the name and location of the .opf file so iBooks can access the book’s metadata.

NCX File

The .ncx file is often referred to as the "table of contents" file because it stores information used to generate bookmarks that link a user to the important sections of a book, such as each chapter.

XHTML

If you are not familiar with XHTML, it is HTML that is written in an XML based document. When creating Fixed Layout iBooks, each page of the book must be contained in its own XHTML file.

CSS

CSS, or Cascading Style Sheets, are a collection of styles that can be applied to different HTML tags. When creating an iBook, external, internal, and in-line CSS is acceptable. However, for organizational purposes, it may be easier to create a separate external CSS file for each page.


Conclusion

Understanding the basic components of an iBook is the first step in learning to be a developer. Stick around for part two of this series where we will dive into creating the files that will ultimately become a working iBook.

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.