# Chapter 3 - Generating Books

This chapter describes how to create a book using HTML files.

## Overview

While HTMLDOC can convert web pages into PostScript and PDF files, its real strength is generating indexed HTML, PostScript, or PDF books.

HTMLDOC uses HTML heading elements to delineate chapters and headings in a book. The `H1` element is used for chapters:

        <HTML>
        <HEAD>
    	<TITLE>The Little Computer that Could</TITLE>
        </HEAD>
        <BODY>
        <H1>Chapter 1 - The Little Computer is Born</H1>
        ...
        <H1>Chapter 2 - Little Computer's First Task</H1>
        ...
        </BODY>
        </HTML>

Sub-headings are marked using the `H2` through `H6` elements.

Note: When using book mode, HTMLDOC starts rendering with the first `H1` element. Any text, images, tables, and other viewable elements that precede the first `H1` element are silently ignored. Because of this, make sure you have an `H1` element in your HTML file, otherwise HTMLDOC will not convert anything.

## Choosing HTML Files

Start by clicking on the Book radio button (1) to specify you'll be converting one or more HTML files into a book.

Your next step is to choose one or more files for conversion by clicking on the Add Files... button (2). When the file chooser dialog appears, pick the file(s) you wish to convert and then click on the OK button. As discussed in Chapter 2, if you don't see the file that you want, double click on the folder with ../ after it.

Also, having all files and images in one folder will make file retrieval much easier.

Figure 3-1: The Input Tab

## Selecting a Title File

HTMLDOC can automatically create a title page for you. Fill in the Title File/Image field (3) or click the Browse... button (4) to locate the file you want to use. If you don't see the file you want, double click on the folder with ../ after it.

When you click on the Page tab, it brings up the screen below. The Header and Footer rows allow you to move the header to six different locations: top right, top middle, top left. bottom right, bottom middle, and bottom left. The default setting is the top middle. Simply click on the arrow tabs to change location of the title. This is also where you can place your logo, page numbers, chapter headings, date, and time.

Figure 3-2: The Output Tab

## Setting the Output Format

The output format is set in the Output tab (4). Click on the Output tab and then click on the HTML, PS, or PDF radio buttons to set the output format.

## Setting the Output File

Now that you've chosen an output format, type the name of the output file into the Output Path field or click on the Browse... button (5) to select the output file using the file chooser.

## Generating the Document

Once you have chosen the output file you can generate it by clicking on the Generate button (6) at the bottom of the HTMLDOC window.

## Saving Your Book

HTMLDOC can save the list of HTML files, the title file, and all other options to a special `.BOOK` file so you can regenerate your book when you make changes to your HTML files.

Click on the Save button (7) to save the current book to a file.