# Chapter 4 - HTMLDOC from the Command-Line

This chapter describes how to use HTMLDOC from the command-line to convert web pages and generate books.

> Note: The free version of HTMLDOC for Windows does not include the command-line program.

## Converting Web Pages

To convert a web page type:

    % htmldoc --webpage -f output.pdf filename.html ENTER
    % htmldoc --webpage -f output.ps filename.html ENTER

where `output.pdf` and `output.ps` are the names of the files you want to generate, and `filename.html` is the HTML file you are converting.

The `--webpage` option tells HTMLDOC that you want to convert a web page or other unstructured document.

The `-f` option tells HTMLDOC what file to generate. If you don't specify an output file then a PDF file is send to the standard output.

## Generating Books

To generate a book from one or more HTML files type:

    % htmldoc --book -f output.html file1.html ... fileN.html ENTER
    % htmldoc --book -f output.pdf file1.html ... fileN.html ENTER
    % htmldoc --book -f output.ps file1.html ... fileN.html ENTER

where `output.html`, `output.pdf`, and `output.ps` are the names of the files you want to generate, and `file1.html` to `fileN.html` are the HTML files you want to use for the book.

The `--book` option tells HTMLDOC that you want to generate a book from the HTML file(s) you specified. HTMLDOC will build a table of contents for the book using the heading elements (`H1`, `H2`, etc.) in your HTML files. It will also add a title page using the document `TITLE` text and other `META` information you supply in your HTML files.

## Setting the Title File

The `--titlefile` option sets the HTML file or image to use on the title page:

    % htmldoc --titlefile filename.bmp ... ENTER
    % htmldoc --titlefile filename.gif ... ENTER
    % htmldoc --titlefile filename.jpg ... ENTER
    % htmldoc --titlefile filename.png ... ENTER
    % htmldoc --titlefile filename.html ... ENTER

HTMLDOC supports BMP, GIF, JPEG, and PNG images, as well as generic HTML text you supply for the title page(s).