Re: Calibre for ZIP?

"Lee Passey" <[email protected]>
Newsgroups gmane.culture.literature.ebook-community
Message-ID <[email protected]>
On Fri, January 21, 2011 5:44 am, cherryfinals wrote:

> Calibre is for creating epub documents. ZIP is a compression format. They are
> two entirely different things.

Actually, .epub files and .zip files are almost identical things, as explained
below.

> Once you use Calibre to create one or more epub files from your original
> document, only then would you compress it with ZIP, ARC or one of the other
> compression utilities in order to make the size smaller.

Because .epub is just .zip with a different file extension it is already
compressed; "compressing" an .epub file will very likely make it larger
(although possibly not due to some of the subtleties of the format).

Let me 'splain about .epubs.

Pretend you have just written the Great American Novel, composed of 20
chapters, 10 illustrations, and a beautiful cover. Each chapter is saved as a
single HTML file (using Microsoft Word to try to build an e-book will cause
you heartache in the long run, trust me). The illustrations are black and
white and stored as .png files, and the cover is in color and saved as .jpeg.
You now want to take all of these component files and store them as a
single-file e-book.

The first thing you will need to do is record some metadata about your e-book.
Metadata is "data about data"; in this case, data /about/ the e-book which
nonetheless /isn't/ the e-book.

Some things are obviously metadata: the title, the authors' and other
contributors' names, subject matter headings, non-title identifiers such as
ISBN and LCCN, etc. -- pretty much all the stuff you frequently see in books
as "Library of Congress in-publication data."

Other things are not quite so obvious, but are still metadata. Examples of
these other things are a list of all the files that make up the complete
e-book, and instructions on how to put them together to make a whole e-book
(this file is the front cover image, these files are the actual content and
should be presented in this order). A Table of Contents is actually metadata,
and not really part of a book itself.

At this point, in addition to the 31 files that make up the corpus of the
e-book we also have another file that contains all this metadata. The actual
format of this file is not important right now. For purposes of this example,
let's name this file "MyCrazyLife.opf".

I could take all 32 files and put them in a zip archive and have a complete
e-book right there. All I need is a User Agent (this is the technical term for
the software and hardware that displays and electronic document for the end
user) that understands the format of the metadata file and can put all the
pieces together seamlessly.

From the perspective of the UA, just one piece of information is missing: how
does it find that metadata file among the 32 or so files stored in the
archive? We can solve that problem by adding yet another file which always has
the same name but which contains the name of the metadata file. Let's name
that file "container.xml". Now, every UA that understands this kind of zip
archive can just open it and look for a file name "container.xml". It then
opens the "container.xml" file and gets the name of the metadata file which it
then uses to compose the e-book for presentation.

We have just reinvented the .epub format.

Of course, the actual .epub specification is a bit more complex, as it must
deal with more complex cases than the simple one I outlined above, but with
one simple addition the zip file I've just described would, in fact, be an
.epub file (every .epub must contain the file "mimetype" with the contents
"application/epub+zip" as the first file in the archive, which must not be
compressed).

I think it's useful for everyone who produces .epub files to understand the
structure of .epub. As a simple exercise, just go download any unprotected
.epub e-book; a good source is the Baen free library,
http://www.baen.com/library/. Then, open the book with your favorite zip tool,
or if you're using a recent version of Windows rename the file to have a .zip
extension and browse into it using the file system explorer. "container.xml"
will be found in the "META-INF" directory, and will contain the name of the
metadata file (will usually have a .opf extension) as a <rootfile> element.

The metadata file is a simple XML text file, and can be opened in any text
editor. Looking at it will help you understand how the files are manifested
and combined, and should also have an example of a Table of Contents.

As the saying goes, "learn the rules, so you know how to break them
appropriately."

> --- On Thu, 1/20/11, Brenna Lyons <[email protected]> wrote:
>
> From: Brenna Lyons <[email protected]>
> Subject: [ebook-community] Calibre for ZIP?
> To: [email protected], [email protected]
> Date: Thursday, January 20, 2011, 1:16 PM
>
> I've been told that Calibre would make great ZIP (HTML) files with tables of
> contents, but Calibre doesn't seem to do this. Is it a plug-in you have to
> download? I'm missing something here, I fear, and I'd really like to try it
> out.

As explained above, it is possible to create .epub files with nothing more
than a simple text editor and a zip tool. Calibre, on the other hand, can do
all those things for you, and can make your life much easier.

Calibre started life primarily as an .epub creation tool, but is drifting more
and more towards a library management tool and reading User Agent. The
creation part is still there, it's just getting a little more difficult to
find.

If you go to the Calibre web site and select the Help option
(http://calibre-ebook.com/help) there are links to a number of tutorials on
how to build e-books with Calibre. One of the better ones is
http://amalthia.mediawood.net/tutorials/ebooks/index.html, which will also
show you how to use Calibre to create Tables of Contents.

The most important thing to know about TOC creation is that your source
documents must have bookmarks in them before any kind of index can be created.
So as you build your content be sure <a>nchor tags are inserted where the
target of a TOC entry should be.




------------------------------------

------------------------------------------------------
Post a message:   ebook-community [[at]] *
Unsubscribe:      ebook-community-unsubscribe [[at]] *
Switch to digest: ebook-community-digest [[at]] *
Switch to normal: ebook-community-normal [[at]] *
Put mail on hold: ebook-community-nomail [[at]] *
Administrator:    ebook-community-owner [[at]] *

(* == yahoogroups.com)
-------------------------------------------------------Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ebook-community/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ebook-community/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    ebook-community-fullfeatured-hHKSG33TihhbjbujkaE4pw@public.gmane.org

<*> To unsubscribe from this group, send an email to:
    ebook-community-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.