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 single web page type:

To convert more than one web page with page breaks between each HTML file, type:

The --webpage option tells HTMLDOC that you want to convert web pages or other unstructured HTML files. You can also use --continuous to convert multiple HTML files without page breaks between files and --book to convert structured HTML files with headings into a book with a table of contents. The default document type is --book.

The -f option tells HTMLDOC the file to generate. If you don't specify an output file, a PDF file is sent to the standard output. The output.pdf and output.ps arguments are the names of the output files you want to generate. The .pdf extension specifies that you want to generate a PDF file, while the .ps extension specifies PostScript output.

The filename.html, file1.html, and fileN.html arguments are the input HTML files you want to convert. The HTML files can also be URLs, for example:

Generating Books

Type one of the following commands to generate a book from one or more HTML files:

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.

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

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. See Chapter 6 - HTML Reference for more information on the META variables that are supported.

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!

Setting the Title File

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

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