This chapter describes all of the command-line options supported by HTMLDOC.
The basic command-line usage for HTMLDOC is:
% htmldoc options filename1.html ... filenameN.md ENTER % htmldoc options filename.book ENTER
The first form converts the named HTML or Markdown files to the specified output format immediately. The second form loads the specified .book file and displays the HTMLDOC window, allowing a user to make changes and/or generate the document interactively.
If no output file or directory is specified, then all output is sent to the standard output file.
On return, HTMLDOC returns an exit code of 0 if it was successful and non-zero if there were errors.
The following command-line options are recognized by HTMLDOC.
The -d option specifies an output directory for the document files.
This option is not compatible with the EPUB or PDF output formats.
The -f option specifies an output file for the document.
The -t option specifies the output format for the document and
can be one of the following:
| Format | Description |
|---|---|
| epub | Generate an EPUB file. |
| html | Generate one or more indexed HTML files. |
| htmlsep | Generate separate HTML files for each heading in the table-of-contents. |
| Generate a PDF file (default version - 1.4). | |
| pdf11 | Generate a PDF 1.1 file for Acrobat Reader 2.0 and later. |
| pdf12 | Generate a PDF 1.2 file for Acrobat Reader 3.0 and later. |
| pdf13 | Generate a PDF 1.3 file for Acrobat Reader 4.0 and later. |
| pdf14 | Generate a PDF 1.4 file for Acrobat Reader 5.0 and later. |
| ps | Generate one or more PostScript files (default level - 2). |
| ps1 | Generate one or more Level 1 PostScript files. |
| ps2 | Generate one or more Level 2 PostScript files. |
| ps3 | Generate one or more Level 3 PostScript files. |
The -v option specifies that progress information should be sent/displayed to the standard error file.
The --batch option specifies a book file that you would like to generate without the GUI popping up. This option can be combined with other options to generate the same book in different formats and sizes:
% htmldoc --batch filename.book -f filename.ps ENTER % htmldoc --batch filename.book -f filename.pdf ENTER
The --bodycolor option specifies the background color for all pages in the document. The color can be specified by a standard HTML color name or as a 6-digit hexadecimal number of the form #RRGGBB.
The --bodyfont option specifies the default text font used for text in the document body. The typeface parameter can be one of the following:
| typeface | Actual Font |
|---|---|
| Arial | Helvetica |
| Courier | Courier |
| Helvetica | Helvetica |
| Monospace | DejaVu Sans Mono |
| Sans | DevaVu Sans |
| Serif | DejaVu Serif |
| Times | Times |
The --bodyimage option specifies the background image for all pages in the document. The supported formats are GIF, JPEG, and PNG.
The --book option specifies that the input files comprise a book with chapters and headings.
The --bottom option specifies the bottom margin. The default units are points (1 point = 1/72nd inch); the suffixes "in", "cm", and "mm" specify inches, centimeters, and millimeters, respectively.
This option is only available when generating PostScript or PDF files.
The --browserwidth option specifies the browser width in pixels. The browser width is used to scale images and pixel measurements when generating PostScript and PDF files. It does not affect the font size of text.
The default browser width is 680 pixels which corresponds roughly to a 96 DPI display. Please note that your images and table sizes are equal to or smaller than the browser width, or your output will overlap or truncate in places.
The --charset option specifies the 8-bit character set encoding to use for the entire document. HTMLDOC comes with the following character set files:
| charset | Character Set |
|---|---|
| cp-874 | Windows code page 874 |
| cp-1250 | Windows code page 1250 |
| cp-1251 | Windows code page 1251 |
| cp-1252 | Windows code page 1252 |
| cp-1253 | Windows code page 1253 |
| cp-1254 | Windows code page 1254 |
| cp-1255 | Windows code page 1255 |
| cp-1256 | Windows code page 1256 |
| cp-1257 | Windows code page 1257 |
| cp-1258 | Windows code page 1258 |
| iso-8859-1 | ISO-8859-1 |
| iso-8859-2 | ISO-8859-2 |
| iso-8859-3 | ISO-8859-3 |
| iso-8859-4 | ISO-8859-4 |
| iso-8859-5 | ISO-8859-5 |
| iso-8859-6 | ISO-8859-6 |
| iso-8859-7 | ISO-8859-7 |
| iso-8859-8 | ISO-8859-8 |
| iso-8859-9 | ISO-8859-9 |
| iso-8859-14 | ISO-8859-14 |
| iso-8859-15 | ISO-8859-15 |
| koi8-r | KOI8-R |
| utf-8 | UTF-8 |
Note: UTF-8 support is limited to the first 128 Unicode characters found in the input.
The --color option specifies that color output is desired.
This option is only available when generating PostScript or PDF files.
The --compression option specifies that Flate compression should be performed on the output file(s). The optional level parameter is a number from 1 (fastest and least amount of compression) to 9 (slowest and most amount of compression).
This option is only available when generating PDF or Level 3 PostScript files.
The --continuous option specifies that the input files comprise a web page (or site) and that no title page or table-of-contents should be generated. Unlike the --webpage option described later in this chapter, page breaks are not inserted between each input file.
This option is only available when generating PostScript or PDF files.
The --cookies option specifies one or more HTTP cookies that should be sent when converting remote URLs. Each cookie must be separated from the others by a semicolon and a space, and values containing whitespace or the semicolon must be placed inside double-quotes. When specifying multiple cookies, the entire cookie string must be surrounded by single quotes in order for the string to be processed correctly.
The --datadir option specifies the location of data files used by HTMLDOC.
The --duplex option specifies that the output should be formatted for two sided printing.
This option is only available when generating PostScript or PDF files. Use the --pscommands option to generate PostScript duplex mode commands.
The --effectduration option specifies the duration of a page transition effect in seconds.
This option is only available when generating PDF files.
The --embedfonts option specifies that fonts should be embedded in PostScript and PDF output. This is especially useful when generating documents in character sets other than ISO-8859-1.
The --encryption option enables encryption and security features for PDF output.
This option is only available when generating PDF files.
The --firstpage option specifies the first page that will be displayed in a PDF file. The page parameter can be one of the following:
| page | Description |
|---|---|
| p1 | The first page of the document. |
| toc | The first page of the table-of-contents. |
| c1 | The first page of chapter 1. |
This option is only available when generating PDF files.
The --fontsize option specifies the base font size for the entire document in points (1 point = 1/72nd inch).
The --fontspacing option specifies the line spacing for the entire document as a multiplier of the base font size. A spacing value of 1 makes each line of text the same height as the font.
The --footer option specifies the contents of the page footer. The lcr parameter is a three-character string representing the left, center, and right footer fields. Each character can be one of the following:
| lcr | Description |
|---|---|
| . | A period indicates that the field should be blank. |
| : | A colon indicates that the field should contain the current and total number of pages in the chapter (n/N). |
| / | A slash indicates that the field should contain the current and total number of pages (n/N). |
| 1 | The number 1 indicates that the field should contain the current page number in decimal format (1, 2, 3, ...) |
| a | A lowercase "a" indicates that the field should contain the current page number using lowercase letters. |
| A | An uppercase "A" indicates that the field should contain the current page number using UPPERCASE letters. |
| c | A lowercase "c" indicates that the field should contain the current chapter title. |
| C | An uppercase "C" indicates that the field should contain the current chapter page number. |
| d | A lowercase "d" indicates that the field should contain the current date. |
| D | An uppercase "D" indicates that the field should contain the current date and time. |
| h | An "h" indicates that the field should contain the current heading. |
| i | A lowercase "i" indicates that the field should contain the current page number in lowercase roman numerals (i, ii, iii, ...) |
| I | An uppercase "I" indicates that the field should contain the current page number in uppercase roman numerals (I, II, III, ...) |
| l | A lowercase "l" indicates that the field should contain the logo image. |
| l | An uppercase "L" indicates that the field should contain the logo image as a letterhead (shown at full size). |
| t | A lowercase "t" indicates that the field should contain the document title. |
| T | An uppercase "T" indicates that the field should contain the current time. |
| u | A lowercase "u" indicates that the field should contain the current filename or URL. |
Setting the footer to "..." disables the footer entirely.
The --format option specifies the output format for the document and can be one of the following:
| Format | Description |
|---|---|
| epub | Generate an EPUB file. |
| html | Generate one or more indexed HTML files. |
| htmlsep | Generate separate HTML files for each heading in the table-of-contents. |
| Generate a PDF file (default version - 1.4). | |
| pdf11 | Generate a PDF 1.1 file for Acrobat Reader 2.0 and later. |
| pdf12 | Generate a PDF 1.2 file for Acrobat Reader 3.0 and later. |
| pdf13 | Generate a PDF 1.3 file for Acrobat Reader 4.0 and later. |
| pdf14 | Generate a PDF 1.4 file for Acrobat Reader 5.0 and later. |
| ps | Generate one or more PostScript files (default level - 2). |
| ps1 | Generate one or more Level 1 PostScript files. |
| ps2 | Generate one or more Level 2 PostScript files. |
| ps3 | Generate one or more Level 3 PostScript files. |
The --gray option specifies that grayscale output is desired.
This option is only available when generating PostScript or PDF files.
The --header option specifies the contents of the page header. The lcr parameter is a three-character string representing the left, center, and right header fields. See the --footer option for the list of formatting characters.
Setting the header to "..." disables the header entirely.
The --header1 option specifies the contents of the page header for the first body/chapter page. The lcr parameter is a three-character string representing the left, center, and right header fields. See the --footer option for the list of formatting characters.
Setting the header to "..." disables the first page header entirely.
The --headfootfont option specifies the font that is used for the header and footer text. The font parameter can be one of the following:
This option is only available when generating PostScript or PDF files.
The --headfootsize option sets the size of the header and footer text in points (1 point = 1/72nd inch).
This option is only available when generating PostScript or PDF files.
The --headingfont options sets the typeface that is used for headings in the document. The typeface parameter can be one of the following:
| typeface | Actual Font |
|---|---|
| Arial | Helvetica |
| Courier | Courier |
| Helvetica | Helvetica |
| Monospace | DejaVu Sans Mono |
| Sans | DevaVu Sans |
| Serif | DejaVu Serif |
| Times | Times |
The --help option displays all of the available options to the standard output file.
The --helpdir option specifies the location of the on-line help files.
The --hfimageN option specifies an image to use in the header and/or footer, where N is a number from 1 to 10. The supported formats are GIF, JPEG, and PNG.
The --jpeg option enables JPEG compression of continuous-tone images. The optional quality parameter specifies the output quality from 0 (worst) to 100 (best).
This option is only available when generating PDF or Level 2 and Level 3 PostScript files.
The --landscape option specifies that the output should be in landscape orientation (long edge on top).
This option is only available when generating PostScript or PDF files.
The --left option specifies the left margin. The default units are points (1 point = 1/72nd inch); the suffixes "in", "cm", and "mm" specify inches, centimeters, and millimeters, respectively.
This option is only available when generating PostScript or PDF files.
The --letterhead option specifies the letterhead image for the page headers and footers for PostScript and PDF files. The supported formats are GIF, JPEG, and PNG.
Note: You need to use the--headerand/or--footeroptions with theLparameter or use the corresponding HTML page comments to display the logo image in the header or footer.
The --linkcolor option specifies the color of links in EPUB, HTML. and PDF output. The color can be specified by name or as a 6-digit hexadecimal number of the form #RRGGBB.
The --links option specifies that PDF output should contain hyperlinks.
The --linkstyle option specifies the style of links in EPUB, HTML, and PDF output. The style can be "plain" for no decoration or "underline" to underline links.
The --logoimage option specifies the logo image for the HTML navigation bar and page headers and footers for PostScript and PDF files. The supported formats are GIF, JPEG, and PNG.
Note: You need to use the--headerand/or--footeroptions with thelparameter or use the corresponding HTML page comments to display the logo image in the header or footer.
The --no-compression option specifies that Flate compression should not be performed on the output files.
The --no-duplex option specifies that the output should be formatted for one sided printing.
This option is only available when generating PostScript or PDF files. Use the --pscommands option to generate PostScript duplex mode commands.
The --no-embedfonts option specifies that fonts should not be embedded in PostScript and PDF output.
The --no-encryption option specifies that no encryption/security features should be enabled in PDF output.
This option is only available when generating PDF files.
The --no-jpeg option specifies that JPEG compression should not be performed on large images.
The --no-links option specifies that PDF output should not contain hyperlinks.
The --no-localfiles option disables access to local files on the system. This option should be used when providing remote document conversion services.
The --no-numbered option specifies that headings should not be numbered.
The --no-pscommands option specifies that PostScript device commands should not be written to the output files.
The --no-strict option turns off strict HTML conformance checking.
The --no-title option specifies that the title page should not be generated.
The --no-toc option specifies that the table-of-contents pages should not be generated.
The --no-xrxcomments option specifies that Xerox PostScript job comments should not be written to the output files.
This option is only available when generating PostScript files.
The --numbered option specifies that headings should be numbered.
The --nup option sets the number of pages that are placed on each output page. Valid values for the pages parameter are 1, 2, 4, 6, 9, and 16.
The --outdir option specifies an output directory for the
document files.
This option is not compatible with the PDF output format.
The --outfile option specifies an output file for the document.
The --owner-password option specifies the owner password for a PDF file. If not specified or the empty string (""), a random password is generated.
This option is only available when generating PDF files.
The --pageduration option specifies the number of seconds that each page will be displayed in the document.
This option is only available when generating PDF files.
The --pageeffect option specifies the page effect to use in PDF files. The effect parameter can be one of the following:
| effect | Description |
|---|---|
| none | No effect is generated. |
| bi | Box Inward |
| bo | Box Outward |
| d | Dissolve |
| gd | Glitter Down |
| gdr | Glitter Down and Right |
| gr | Glitter Right |
| hb | Horizontal Blinds |
| hsi | Horizontal Sweet Inward |
| hso | Horizontal Sweep Outward |
| vb | Vertical Blinds |
| vsi | Vertical Sweep Inward |
| vso | Vertical Sweep Outward |
| wd | Wipe Down |
| wl | Wipe Left |
| wr | Wipe Right |
| wu | Wipe Up |
This option is only available when generating PDF files.
The --pagelayout option specifies the initial page layout in the PDF viewer. The layout parameter can be one of the following:
| layout | Description |
|---|---|
| single | A single page is displayed. |
| one | A single column is displayed. |
| twoleft | Two columns are displayed with the first page on the left. |
| tworight | Two columns are displayed with the first page on the right. |
This option is only available when generating PDF files.
The --pagemode option specifies the initial viewing mode in the PDF viewer. The mode parameter can be one of the following:
| mode | Description |
|---|---|
| document | The document pages are displayed in a normal window. |
| outline | The document outline and pages are displayed. |
| fullscreen | The document pages are displayed on the entire screen in "slideshow" mode. |
This option is only available when generating PDF files.
The --path option specifies a search path for files that are loaded by HTMLDOC. It is usually used to get images that use absolute server paths to load.
Directories are separated by the semicolon (;) so that drive letters and URLs can be specified. Quotes around the directory parameter are optional. They are usually used when the directory string contains spaces.
--path "dir1;dir2;dir3;...;dirN"
The --permissions option specifies the document permissions. The available permission parameters are listed below:
| Permission | Description |
|---|---|
| all | All permissions |
| annotate | User can annotate document |
| copy | User can copy text and images from document |
| modify | User can modify document |
| User can print document | |
| no-annotate | User cannot annotate document |
| no-copy | User cannot copy text and images from document |
| no-modify | User cannot modify document |
| no-print | User cannot print document |
| none | No permissions |
The --encryption option must be used in conjunction with the --permissions parameter.
--permissions no-print --encryption
Multiple options can be specified by separating them with commas:
--permissions no-print,no-copy --encryption
This option is only available when generating PDF files.
The --portrait option specifies that the output should be in portrait orientation (short edge on top).
This option is only available when generating PostScript or PDF files.
The --pdf-indent option specifies the indentation for pre-formatted content. The default units are points (1 point = 1/72nd inch); the suffixes "in", "cm", and "mm" specify inches, centimeters, and millimeters, respectively.
The --pscommands option specifies that PostScript device commands should be written to the output files.
This option is only available when generating Level 2 and Level 3 PostScript files.
The --quiet option prevents error messages from being sent to stderr.
The --referer option sets the URL that is passed in the Referer: field of HTTP requests.
The --right option specifies the right margin. The default units are points (1 point = 1/72nd inch); the suffixes "in", "cm", and "mm" specify inches, centimeters, and millimeters, respectively.
This option is only available when generating PostScript or PDF files.
The --size option specifies the page size. The size parameter can be one of the following standard sizes:
| size | Description |
|---|---|
| Letter | 8.5x11in (216x279mm) |
| A4 | 8.27x11.69in (210x297mm) |
| Universal | 8.27x11in (210x279mm) |
Custom sizes are specified by the page width and length separated by the letter "x" to select a custom page size. Append the letters "in" for inches, "mm" for millimeters, or "cm" for centimeters.
This option is only available when generating PostScript or PDF files. Use the --pscommands option to generate PostScript page size commands.
The --strict option turns on strict HTML conformance checking. When enabled, HTML elements that are improperly nested and dangling close elements will produce error messages.
The --textcolor option specifies the default text color for all pages in the document. The color can be specified by a standard HTML color name or as a 6-digit hexadecimal number of the form #RRGGBB.
The --textfont options sets the typeface that is used for text in the document. The typeface parameter can be one of the following:
| typeface | Actual Font |
|---|---|
| Arial | Helvetica |
| Courier | Courier |
| Helvetica | Helvetica |
| Monospace | DejaVu Sans Mono |
| Sans | DevaVu Sans |
| Serif | DejaVu Serif |
| Times | Times |
The --title option specifies that a title page should be generated.
The --titlefile option specifies a HTML or Markdown file to use for the title page.
The --titleimage option specifies the title image for the title page. The supported formats are GIF, JPEG, and PNG.
The --tocfooter option specifies the contents of the table-of-contents footer. The lcr parameter is a three-character string representing the left, center, and right footer fields. See the --footer option for the list of formatting characters.
Setting the TOC footer to "..." disables the TOC footer entirely.
The --tocheader option specifies the contents of the table-of-contents header. The lcr parameter is a three-character string representing the left, center, and right header fields. See the --footer option for the list of formatting characters.
Setting the TOC header to "..." disables the TOC header entirely.
The --toclevels options specifies the number of heading levels to include in the table-of-contents pages. The levels parameter is a number from 1 to 6.
The --toctitle options specifies the string to display at the top of the table-of-contents; the default string is "Table of Contents".
The --top option specifies the top margin. The default units are points (1 point = 1/72nd inch); the suffixes "in", "cm", and "mm" specify inches, centimeters, and millimeters, respectively.
This option is only available when generating PostScript or PDF files.
The --user-password option specifies the user password for a PDF file. If not specified or the empty string (""), no password will be required to view the document.
This option is only available when generating PDF files.
The --verbose option specifies that progress information should be sent/displayed to the standard error file.
The --version option displays the HTMLDOC version number.
The --webpage option specifies that the input files comprise a web page (or site) and that no title page or table-of-contents should be generated. HTMLDOC will insert a page break between each input file.
This option is only available when generating PostScript or PDF files.
The --xrxcomments option specifies that Xerox PostScript job comments should be written to the output files.
This option is only available when generating PostScript files.
HTMLDOC looks for several environment variables which can override the default directories, display additional debugging information, and disable CGI mode.
This environment variable specifies the location of HTMLDOC's data and fonts directories, normally /usr/share/htmldoc or C:\Program Files\HTMLDOC.
This environment variable enables debugging information that is sent to stderr. The value is a list of keywords separated by spaces:
| keyword | Information Shown |
|---|---|
links | Shows all of the links in a document |
memory | Shows memory usage statistics |
remotebytes | Shows the number of bytes that were transferred via HTTP |
table | Puts a box around each table, row, and cell |
tempfiles | Shows the temporary files that were created, and preserves them for debugging |
timing | Shows the load and render times |
all | All of the above |
This environment variable specifies the location of HTMLDOC's documentation directory, normally /usr/share/doc/htmldoc or C:\Program Files\HTMLDOC\doc.
This environment variable, when set (the value doesn't matter), disables CGI mode. It is most useful for using HTMLDOC on a web server from a scripting language or invocation from a program.
HTMLDOC sends error and status messages to stderr unless the --quiet option is provided on the command-line. Applications can capture these messages to relay errors or statistics to the user.
The BYTES: message specifies the number of bytes that were written to an output file. If the output is directed at a directory then multiple BYTES: messages will be sent.
The DEBUG: messages contain debugging information based on the value of the HTMLDOC_DEBUG environment variable. Normally, no DEBUG: messages are sent by HTMLDOC.
The ERRnnn: messages specify an error condition. Error numbers 1 to 14 map to the following errors:
Error numbers 100 to 505 correspond directly to a HTTP status code.
The INFO: messages contain general information that is logged when HTMLDOC is running in CGI mode or when you use the --verbose option.
The PAGES: message specifies the number of pages that were written to an output file. If the output is directed at a directory then multiple PAGES: messages will be sent. No PAGES: messages are sent when generating HTML or EPUB output.
The REMOTEBYTES: message specifies the number of bytes that were transferred using HTTP. This message is only displayed if the HTMLDOC_DEBUG environment variable has the keyword remotebytes or all.
The TIMING: message specifies the load, render, and total time in seconds for the current command. This message is only displayed if the HTMLDOC_DEBUG environment variable has the keyword timing or all.