# Appendix B - Book File Format

This appendix describes the HTMLDOC .book file format.

## Introduction

The HTMLDOC .book file format is a simple text format that provides the command-line options and files that are part of the document. These files can be used from the GUI interface or from the command-line using the `--batch` option:

    htmldoc filename.book
    htmldoc --batch filename.book

The first form will load the book and display the GUI interface, if configured. Windows users should use ghtmldoc.exe executable to show the GUI and htmldoc.exe for the batch mode:

    ghtmldoc.exe filename.book
    htmldoc.exe --batch filename.book

## The Header

Each .book file starts with a line reading:

    #HTMLDOC 1.8.17

The version number (1.8.17) is optional.

## The Options

Following the header is a line containing the options for the book. You can use any valid command-line option on this line:

    -f htmldoc.pdf --titleimage htmldoc.png --duplex --compression=9 --jpeg=90

Long option lines can be broken using a trailing backslash (`\`) on the end of each continuation line:

    -f htmldoc.pdf --titleimage htmldoc.png --duplex \
    --compression=9 --jpeg=90

## The Files

Following the options are a list of files or URLs to include in the document:

    intro.html
    1-install.html
    2-starting.html
    3-books.html
    4-cmdline.html
    5-cgi.html
    6-htmlref.html
    7-guiref.html
    8-cmdref.html
    a-license.html
    b-book.html
    c-relnotes.html

## Putting It All Together

The following is the complete book file needed to generate this documentation:

    #HTMLDOC 1.8.13
    -f htmldoc.pdf --titleimage htmldoc.png --duplex --compression=9 --jpeg=90
    intro.html
    1-install.html
    2-starting.html
    3-books.html
    4-cmdline.html
    5-cgi.html
    6-htmlref.html
    7-guiref.html
    8-cmdref.html
    a-license.html
    b-book.html
    c-relnotes.html

## Older Book Files

Prior to HTMLDOC version 1.8.12, the book file format was slightly different:

    #HTMLDOC version
    file count
    file(s)
    options

While HTMLDOC still supports reading this format, we do not recommend using it for new books. In particular, when generating a document using the `--batch` option, some options may not be applied correctly since the files are loaded prior to setting the output options in the old format.