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
#!/bin/sh
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.
KNOWN BUGS:
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).
