To create him, execute the following command:
root:/> useradd -m offi2pdf
office2pdf:~> tar xfzv office2pdf-0.10.6.tar.gz
Also, a number of directories will be needed later in this installation:
office2pdf:~> mkdir -p ~/fonts/afm
office2pdf:~> mkdir -p ~/fonts/ttf
office2pdf:~> mkdir -p ~/wininstall
office2pdf:
N.B. The presence of the printer "definition" in the
/etc/printcap is enough. No need to even install any print
queuing system, such as lpd or cups. The printer
definition doesn't even need to be complete. Of course, this step can
be skipped if there are already printers defined on the system.
offi2pdf:~> wget http://hoopajoo.net/static/projects/xautomation-0.96.tar.gz
offi2pdf:~> tar xfzv xautomation-0.96.tar.gz
offi2pdf:~> cd xautomation-0.96
offi2pdf:~/xautomation-0.96> ./configure
offi2pdf:~/xautomation-0.96> make
offi2pdf:~/xautomation-0.96> su
root:/home/offi2pdf/xautomation-0.96> make install
root:/> apt install wine
As offi2pdf, run wine once, so that it creates a default
config in his .wine directory:
offi2pdf:~> wine notepad.exe
By doing a File->Print, verify that wine sees your printer
defined above. Exit notepad, and edit .wine/config:
[Drive K]
"Type" = "network"
"Path" = "%OFFICE2PDF%/tmp/wineIn"
"Label" = "incoming"
"FS" = "win95"
[Drive L]
"Type" = "network"
"Path" = "%HOME%/wininstall"
"Label" = "installation"
"FS" = "win95"
[Drive T]
"Type" = "network"
"Path" = "%OFFICE2PDF%/regTweaks"
"Label" = "registry tweaks"
"FS" = "win95"
For newer wine versions, drives are no longer stored in the config
file, but instead are symbolic links in the
$HOME/.wine/doservices directory.
Execute the following commands as follows:
offi2pdf:~> cd .wine/dosdevices
offi2pdf:~/.wine/dosdevices> rm z:
offi2pdf:~/.wine/dosdevices> ln -s $HOME/office2pdf/tmp/wineIn k:
offi2pdf:~/.wine/dosdevices> ln -s $HOME/wininstall l:
offi2pdf:~/.wine/dosdevices> ln -s $HOME/office2pdf/regTweaks t:
offi2pdf:~> cp office2pdf/winUtil/enumWin.exe $HOME/.wine/dosdevices/c:
[Drive X]
"Type" = "network"
"Path" = "%OFFICE2PDF%/tmp/tmp"
"Label" = "temporary files"
"FS" = "win95"
Likewise, for newer wine versions, do the appropriate link in
dosdevices instead:
offi2pdf:~/.wine/dosdevices> ln -sf $HOME/office2pdf/tmp/tmp x:
If you chose not to install any optional fonts, you may need to fix the path to generic.ppd in the ~/.wine/config:
[ppd]
"generic" = "/usr/share/wine/generic.ppd"
This may depend on wine version. For instance, wine-20040813 on SuSE
has the file located on /usr/share/wine/generic.ppd, but the
default config file generated by wine points to
/usr/lib/wine/generic.ppd. Obviously, if the config
file already points to an existing generic.ppd file, no
action is necessary.
Then install them into wine:
offi2pdf:~> cd wininstall
offi2pdf:~/wininstall> wine wd97vwr32.exe
offi2pdf:~/wininstall> wine xlViewer.exe
offi2pdf:~/wininstall> wine PPView97.exe
offi2pdf:~> cd office2pdf
offi2pdf:~/office2pdf> vncpasswd .vncpass
Name | Meaning |
$sender | Sender address from which replies will be sent. |
$defaultSubject | Subject to use for reply mail, if user didn't include any |
$boilerplate | Small introductory text to be included in reply messages. |
offi2pdf:~> cd office2pdf
offi2pdf:~/office2pdf> bin/worker.pl
Optionally, from another Window, open up a viewonly Vnc session to
localhost:99 in order to observe how office2pdf works...:
offi2pdf:~> vncviewer -viewonly :99
The -viewonly option is to avoid accidentally disturbing
office2pdf when moving the mouse over the Vnc windows, etc.Drop a Word or Excel file into the incoming folder. This is best done atomically with a copy followed by a move, rather than directly copying it. A nice example of such a file is the README.DOC included with the word viewer itself.
offi2pdf:~> cp ".wine/fake_windows/Program Files/WordView/README.DOC" .
offi2pdf:~> mv README.DOC office2pdf/flatIn
When it is done (about a minute afterwards), your pdf file should
appear in office2pdf/flatOut.If something doesn't work, check using vncviewer where exactly it is stuck. In case of failure, you can then also launch vncviewer without the -viewonly option, and "help" office2pdf by manually performing the action where it seems stuck (opening the printer dialog, clicking print, etc.). When reporting a bug, include a brief description of where it seems to be stuck, and what happens when you "help" it.
Next, you can test whether it is capable of replying to mails:
offi2pdf:~/office2pdf> ./bin/unpacker.pl < ~/test.mail
Thus, in order to give faster responses on failed jobs, apply the nodebug registry tweak:
regedit t:nodebug.reg
(Yes, this does not actually call echo... But hey, it disables the
debugger!)
root:/> chown -R root ~offi2pdf/.wine
Should any further intervention be necessary, you can open it up again
as follows:
root:/> chown -R root ~offi2pdf/.wine
root:/> cp ~offi2pdf/office2pdf/bin/office2pdf /etc/init.d
root:/> chkconfig --add office2pdf
root:/> /etc/init.d/office2pdf start
The above makes sure that office2pdf is started automatically after
each reboot.
"|/home/offi2pdf/office2pdf/bin/unpacker.pl"
Optionally, put an alias into /etc/aliases, and run
newaliases:
office2pdf: offi2pdf
In order to avoid authentication warnings in the headers of the mails
sent out by office2pdf, you can add the offi2pdf user to
/etc/mail/trusted-users and do an /etc/init.d/sendmail
reload
Your office2pdf is now ready and accepts .doc and .xls mails. Test it
out by sending it some Word documents. In case of problems, you can
still use vncviewer to check out where it is blocked.