Very fast .doc viewer

Share your own howto's etc. Not for support questions!

Very fast .doc viewer

Postby canci » 2008-02-29 07:24

Tired of firing up OpenOffice just to view a simple .doc file?
Then this might be the right thing for you. Well, it might not be
the best viewer you can get, but on my machine it's faster than
waiting for OpenOffice to load - compare 1 second to more than 10.

NOTE: This was done on an Etch setup.

The philosophy behind it is the following:
1. We use antiword to convert the given .doc file to a temporary, hidden
pdf file stored in the user's home folder (to ensure write permission)
2. xpdf views the pdf file
3. the hidden pdf file is deleted

A. Here's what we need:
Code: Select all
sudo apt-get install antiword xpdf-reader

B. Open your editor and type:
Code: Select all
LANG="bs_BA" antiword -a a4 "$1" > ~/.doctmp.pdf && xpdf ~/.doctmp.pdf && rm ~/.doctmp.pdf

Now, some explanation:

The LANG flag sets a language environment. This is necessary if you use UTF-8, since antiword
doesn't support PDF conversion in UTF-8 for now. In order to use another language flag,
you'll previously have to add another one, which is done by:
Code: Select all
sudo dpkg-reconfigure locales

Choose one that's not UTF-8, like my "bs_BA", which is different from my default "bs_BA.UTF-8".

the -a a4 flag in antiword tells the programme to convert to PDF in the paper format A4.
If this bothers you, type this to find out about other formats:
Code: Select all
man antiword

I use xpdf as the PDF viewer, but you could also use any other like evince or KPDF.

C. Let's save the file. I chose the name docview. Then make it executable by issuing:
Code: Select all
chmod +x docview

Now just move the file under ~/.bin/ or /usr/local/bin/

D. You can now enter something like this in the command line to see the fruit of your work:
Code: Select all
docview file.doc

I use Thunar, so I set this command to be the default viewer for .doc and .DOC files.

Don't expect a perfect output - antiword still struggles with images - at least on Etch
(it won't display most of my documents' images, but otherwise the formatting is more or less fine).
I ken hez kinvulf beck? I ken hez riesnible modereyshn? Kthnxbai!

No need to discuss this topic? Offended by this signature? Remove it:

Mez wrote:You can easily just disable viewing signatures

Click here - and set "Display Signatures" to No
User avatar
Posts: 1705
Joined: 2006-09-24 11:28
Location: Bosnia & Herzegovina

Postby Issyer » 2008-02-29 17:28

Nice howto. Here is mine.

Quick All Word Documents Viewing with a Nice Output

Step 1:
Install wine:
Code: Select all
apt-get install wine

Or get wine from here:

Step 2:
Install Word Viewer 2003 in wine.

Step 3:
Make a file wordviewer with the following content:
Code: Select all

if [ -r "$1" ]; then
   cd `dirname "$path"`
   exec wine "c:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.EXE" "`basename "$path"`" "$@"
   exec wine "c:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.EXE" "$@"

Step 4:
Run as root:
Code: Select all
chmod 755 wordviewer
cp wordviewer /usr/bin

Step 5:
Now you can go to the properties with you mouse right click to associate M$ Word extensions with wordviewer.
User avatar
Posts: 3055
Joined: 2007-05-23 02:59
Location: Khakassia

Package description for "wv"

Postby craigevil » 2008-02-29 23:00

wv -
Programs for accessing Microsoft Word documents
wvWare (previously known as mswordview) is a library that allows access to Microsoft Word files. It can load and parse the Word 2000, Word 97, Word 95, and Word 6 file formats. (Work is underway to support reading earlier formats as well: Word 2 documents are converted to plain text.)
This package provides the following programs:
* wvWare: Converts to HTML and LaTeX. It's used by a small army of
helper scripts able to preview Word documents and convert them to various other formats, like PostScript, PDF, DVI, etc.
* wvRTF: Converts to Microsoft's Rich Text Format.
* wvSummary: Displays the summary information stream of all OLE2 files,
i.e. Excel, PowerPoint, Visio, Access, etc.
* wvVersion: Outputs the version of the Word format a document is stored
Note that conversion to DVI, PostScript, or PDF requires the tetex-extra package; PDF conversion also requires Ghostscript. Having ELinks, Links, or Lynx will greatly improve the plain text output. ImageMagick may help with the quality of images. If you wish to preview Word documents from the comfort of your mail reader, install a PostScript viewer like gv.

apt-get install wv and your good to go.
Debian Sid KDE Kernel 3.17 Thinkpad R40 Intel M 1.3 CPU 2GB RAM Radeon Mobility 7500
Debian - "If you can't apt-get something, it isn't useful or doesn't exist"
Debian upgrade script smxi | sysinfo script inxi
User avatar
Posts: 5192
Joined: 2006-09-17 03:17
Location: Oz

Postby KOTAPAKA » 2008-10-15 12:30

Just a quick update. There is this thing called catdoc which I find very useful in displaying MS word files. It is small as well so worth giving it a go if you are struggling with .doc's
Debian Lenny "stable"
User avatar
Posts: 507
Joined: 2008-02-22 00:26
Location: UK

Postby reidar » 2008-10-27 12:26

If you install Midnight Commander (mc) along with antiword, it's even faster. Navigate to a word document in mc, press F3, and ... voila!

Posts: 34
Joined: 2006-06-09 09:52
Location: Stavanger, Norway

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests