File: 4-cmdline.html

package info (click to toggle)
htmldoc 1.8.27-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 11,708 kB
  • ctags: 5,685
  • sloc: ansic: 43,156; cpp: 22,678; perl: 395; makefile: 303; java: 59; php: 36; xml: 10; sh: 7
file content (207 lines) | stat: -rw-r--r-- 6,303 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<HTML>
<BODY>

<!-- FOOTER RIGHT "4-$CHAPTERPAGE" -->
<DIV ALIGN="justify">

<H1 ALIGN="RIGHT"><A NAME="CMDLINE">Chapter 4 - HTMLDOC from the
Command-Line</A></H1>

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

<h2>Getting to the Command-Line on Windows</h2>

<p>Do the following steps to access the command-line on Windows:</p>

<ol>

	<li>Click on <var>Start</var> at the bottom left corner
	of your screen</li>

	<li>Click on <var>All Programs</var></li>

	<li>Click on <var>Accessories</var></li>

	<li>Click on <var>Command Prompt</var></li>

</ol>

<p> After you have clicked command prompt, your screen should
look something like Figure 4-1.</p>

<p align='center'><img src='htmldoc-fig41.png'
alt='Command prompt window'><br />
<i>Figure 4-1: Command prompt window</i></p>

<p>To see what's in this directory, type the following command:</p>

<pre>
    <kbd>dir ENTER<kbd>
</pre>

<p>You now have a list of available files and directories that you can
use. To access a different directory simply type <kbd>cd</kbd>
and the name of the new directory. For example, type the following
if you want to access a directory called <var>Steve</var>:</p>

<pre>
    <kbd>cd Steve ENTER</kbd>
</pre>

<h2>The Basics of Command-Line Access</h2>

<p>To convert a single web page type:

<pre>
    <kbd>htmldoc --webpage -f output.pdf filename.html ENTER</kbd>
</pre>

<h3>What Are All These Commands?</h3>

<p><tt>htmldoc</tt> is the name of the software.</p>

<p><tt>--webpage</tt> is the document type that specifies
unstructured files with page breaks between each file.</p>

<p><tt>-f output.pdf</tt> is the file name that you will save
all the documents into and also the type of file it is. In
this example it is a PDF file.</p>

<p><tt>filename.html</tt> is the name of the file that you want
to be converted and the type of file it is. In this example it
is a HTML file.</p>

<p>Try the following exercise: You want to convert the file
<var>myhtml.html</var> into a PDF file. The new file will be
called <var>mypdf.pdf</var>. How would you do this? (Don't worry,
it's answered for you on the next line. But try first.)</p>

<p>To accomplish this type:</p>

<pre>
    <kbd>htmldoc --webpage -f mypdf.pdf myhtml.html ENTER</kbd>
</pre>

<h2>Converting Multiple HTML Files</h2>

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

<pre>
    <kbd>htmldoc --webpage -f output.pdf file1.html file2.html ENTER</kbd>
</pre>

<p>All we are doing is adding another file. In this example we
are converting two files: <var>file1.html</var> and
<var>file2.html</var>.</p>

<p>Try this example: Convert <var>one.html</var> and
<var>two.html</var> into a PDF file named <var>12pdf.pdf</var>.
Again, the answer is on the next line.</p>

<p>Your line command should look like this:</p>

<pre>
    <kbd>htmldoc --webpage -f 12pdf.pdf one.html two.html ENTER</kbd>
</pre>

<p>We've been using HTML files, but you can also use URLs. For
example:</p>

<pre>
    <kbd>htmldoc --webpage -f output.pdf http://slashdot.org/ ENTER</kbd>
</pre>

<!-- NEED 4in -->
<h2>Generating Books</h2>

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

<pre>
    <kbd>htmldoc --book -f output.html file1.html file2.html ENTER</kbd>
    <kbd>htmldoc --book -f output.pdf file1.html file2.html ENTER</kbd>
    <kbd>htmldoc --book -f output.ps file1.html file2.html ENTER</kbd>
</pre>

<h3>What are all these commands?</h3>

<p><tt>htmldoc</tt> is the name of the sofware.</p>

<p><tt>--book</tt> is a type of document that specifies that
the input files are structured with headings.</p>

<p><tt>-f output.html</tt> is where you want the converted files
to go to. In this case, we requested the file be a HTML file. We
could have made it a PDF (<tt>-f output.pdf</tt>) or Postscript
(<tt>-f ouput.ps</tt>), too.</p>

<p><tt>file1.html</tt> and <tt>file2.html</tt> are the files you
want to convert.</p>  

<p>HTMLDOC will build a table of contents for the book using the
heading elements (<code>H1</code>, <code>H2</code>, etc.) in
your HTML files. It will also add a title page using the
document <code>TITLE</code> text (you're going to learn about
title files shortly) and other <code>META</code> information you
supply in your HTML files. See <A HREF="#HTMLREF">Chapter 6 -
HTML Reference</A> for more information on the <code>META</code>
variables that are supported.</p>

<center><table width="80%" border="1" cellpadding="5" cellspacing="0" bgcolor="#cccccc">
<tr>
	<td><b>Note:</b>

	<p>When using book mode, HTMLDOC starts rendering with
	the first <code>H1</code> element.  Any text, images,
	tables, and other viewable elements that precede the
	first <code>H1</code> element are silently ignored.
	Because of this, make sure you have an <code>H1</code> 
        element in your HTML file, otherwise HTMLDOC will not 
        convert anything!</p>
	</td>
</tr>
</table></center>

<!-- NEED 2in -->
<h2>Setting the Title File</h2>

<p>The <code>--titlefile</code> option sets the HTML file or
image to use on the title page:

<pre>
    <kbd>htmldoc --titlefile filename.bmp ... ENTER</kbd>
    <kbd>htmldoc --titlefile filename.gif ... ENTER</kbd>
    <kbd>htmldoc --titlefile filename.jpg ... ENTER</kbd>
    <kbd>htmldoc --titlefile filename.png ... ENTER</kbd>
    <kbd>htmldoc --titlefile filename.html ... ENTER</kbd>
</pre>

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

<h3>Putting It All Together</h3>

<pre>
    <kbd>htmldoc --book -f 12book.pdf 1book.html 2book.html --titlefile bookcover.jpg ENTER</kbd>
</pre>

<p>Take a look at the entire command line. Dissect the
information. Can you see what the new filename is? What are the
names of the files being converted? Do you see the titlepage
file? What kind of file is your titlefile?</p>

<p>Figure it out? The new file is <var>12book.pdf</var>. The
files converted were <var>1book.html</var> and
<var>2book.html</var>. A title page was created using the JPEG
image file <var>bookcover.jpg</var>.</p>

<p><a href="#HTMLREF">Chapter 8 - Command Line Reference</a>
digs deeper into what you can do with the the command line
prompt.</p>

</div>

</body>
</html>