To create him, execute the following command:
root:/> useradd -m offi2pdf
Also, a number of directories will be needed later in this installation:
office2pdf:~> tar xfzv office2pdf-0.10.6.tar.gz
office2pdf:~> mkdir -p ~/fonts/afm office2pdf:~> mkdir -p ~/fonts/ttf office2pdf:~> mkdir -p ~/wininstall
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
As offi2pdf, run wine once, so that it creates a default config in his .wine directory:
root:/> rpm -U wine-0.9.21-SuSELinux101.i586.rpm
By doing a File->Print, verify that wine sees your printer defined above. Exit notepad, and edit .wine/config:
offi2pdf:~> wine notepad.exe
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:
[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"
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:
Likewise, for newer wine versions, do the appropriate link in dosdevices instead:
[Drive X] "Type" = "network" "Path" = "%OFFICE2PDF%/tmp/tmp" "Label" = "temporary files" "FS" = "win95"
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:
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.
[ppd] "generic" = "/usr/share/wine/generic.ppd"
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
|$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.|
Optionally, from another Window, open up a viewonly Vnc session to localhost:99 in order to observe how office2pdf works...:
offi2pdf:~> cd office2pdf offi2pdf:~/office2pdf> bin/worker.pl
The -viewonly option is to avoid accidentally disturbing office2pdf when moving the mouse over the Vnc windows, etc.
offi2pdf:~> vncviewer -viewonly :99
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.
When it is done (about a minute afterwards), your pdf file should appear in office2pdf/flatOut.
offi2pdf:~> cp ".wine/fake_windows/Program Files/WordView/README.DOC" . offi2pdf:~> mv README.DOC office2pdf/flatIn
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:
(Yes, this does not actually call echo... But hey, it disables the debugger!)
Should any further intervention be necessary, you can open it up again as follows:
root:/> chown -R root ~offi2pdf/.wine
root:/> chown -R root ~offi2pdf/.wine
The above makes sure that office2pdf is started automatically after each reboot.
root:/> cp ~offi2pdf/office2pdf/bin/office2pdf /etc/init.d root:/> chkconfig --add office2pdf root:/> /etc/init.d/office2pdf start
Optionally, put an alias into /etc/aliases, and run newaliases:
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.