As we were upgrading a Linux fax server machine, we noticed that sending facsimiles directly from LibreOffice wasn’t available for the client machines. But unlike with earlier versions of the Office suites, this time it seemed more complicated to get things up & running.
The list of requirements isn’t too long:
- As quite often within these articles, this again is about Linux clients – OpenSUSE 12.1 64bit, running inside a Xen VM (although that doesn’t matter at all ;)). LibreOffice is at the 3.5.4 level, which is what is coming with the distribution.
- It’s a corporate setup, the users can log in to any client machine and will have access to their personal profile. Their e-mail address is not “username@clientmachine” – “email@example.com” seems to work, but exceptions were possible, as always.
- Users are to be notified via email about retransmission attempts as well as successful transmissions.
- There’s a single central Hylafax server, to be used by everyone.
- Facsimiles shouldn’t use Hylafax-generated cover pages
Creating the Fax “target”
There’s no default “fax” entry in the LibreOffice menues. The usual way to handle this is by adding a “virtual printer” by invoking a special administration program that comes with LibreOffice.
Usually, one would add a single printer definition for all users on a machine. Unfortunately, this was no option in our case, as we had no way to automatically detect the e-mail address of the current user. (Wouldn’t it be nice if LibeOffice would make the user’s e-mail address available during its command substition, like “NUMBER” or the PostScript file name (“TMP”)?).
So as a user, run the “spadmin” command (in our case found as “/usr/lib64/libreoffice/program/spadmin”) and add a new (fax) printer. The command line we used for the printing program can be seen in the configuration file created by “spadmin”, found in the user’s home directory (“~/.config/libreoffice/3-suse/user/psprint/psprint.conf”):
Command=/usr/bin/sendfax -h faxserver.client.com -f "Our User <firstname.lastname@example.org>" -n -R -s a4 -d "(PHONE)" (TMP)
SubstFont_Times New Roman=Times
The string “(PHONE)” will be replaced by the phone number that can be entered after “printing” your document to the “fax printer”. “(TMP)” will be replaced by the name of a temporary file generated by LibreOffice, containing the document to be faxed.
Please note the setting “PDFDevice=0″ – when just adding the printer, this would be set to “1″, so you either change that within “spadmin” (by selecting and changing the newly created “printer”, within its device settings altering “printer language” from “PDF” to Postscript) or by manually editing the created configuration file.
Weren’t it for the e-mail notifications, we could have created a common printer definition for all users by invoking “spadmin” as user “root”. The corresponding configuration file would have been “/usr/lib64/libreoffice/share/psprint/psprint.conf” and a possible command line might have been “/usr/bin/sendfax -h faxserver.client.com -n -N -s a4 -d “(PHONE)” (TMP)”.
When we first created the fax printer and tried to “print” a test facsimile, we saw no means of entering the destination number. Granted, the usual entry popup is quite small and can go by unnoticed easily – but no matter how close we looked, there was no such window ;).
This was caused by a wrong default setting for the “language” of the new printer – when set to “PDF”, you get no window, but when set to “PostScript”, all is well.
The setting can be changed via “spadmin”, in “spadmin.conf” (both described above) or with each print job in the printer device settings.
Sending the document
It’s as easy a printing – actually, you *do* print the document to the “fax printer”. All you have to do on top is to specify the destination number:
- print the document
- while the “printing page x of y” message box is visible, another popup will allow you to enter the destination number in any format understood by your fax server
You can customize the LibreOffice menues – i.e., you can add a “print to standard fax” entry to the “File” – “Send” menu:
- Extras – Customize tool bar
- select the menu, i.e. “File | Send”
- Press the “Add” button to add an entry
- Select “document” in the left list
- select “Send default fax” in the right list and add that entry
In addition, you need to set your new fax printer as the default fax entry in Extras – Options – LibreOffice Writer – Printers.
That’s all – now you can simply send the document per fax by selecting “File – Send – Send to default fax”