
170
|
Chapter 7, Terminal Empowerment
#53 Display PDF Documents in a Terminal
HACK
Note the one subtle addition, 2>/dev/null. This simply redirects any error
messages to the twilight zone so that they do not interfere with the presenta-
tion of the Word document. Store it as /usr/local/bin/viewdoc and make the
script executable with this command:
# chmod +x /usr/local/bin/viewdoc
Now all you have to do to view a Word document in a text console or termi-
nal is issue this command:
$ viewdoc document.doc
Not only does this technique preserve at least some of the formatting of a
Word document, but also, hyperlinks are live and you can activate them to
visit the URL from within the w3m viewer you’re using to view the docu-
ment. Figure 7-3 shows an example of a Word document viewed with w3m.
Note both the bold headings and the live link to http://www.bootsplash.de/files.
HACK
#53
Display PDF Documents in a Terminal Hack #53
You can view PDF documents in a terminal or console; no graphical desktop
is required.
This hack is similar to the previous one, which converts Word documents
into HTML. But this hack shows you how to convert PDF documents into
HTML. Then you view the HTML version with a text-based browser or
pager called elinks. (The previous hack used the w3m text browser, but
Figure 7-3. A Word document viewed in HTML text format