Personal tools
You are here: Home / OSCAR EMR 12.x / 4.0 Developers / 4.5 OSCAR Faxing / 4.5.4 MFP faxing with T.37

4.5.4 MFP faxing with T.37

Many multifunction printers allow for OSCAR to fax directly through them


T.37 is an ITU standard which deals with sending fax messages using email. It is also referred to as "iFax", "Internet Fax", or "Store-forward-fax".

A T.37-compliant fax machine will receive emails which have the document attached (using the MIME format) as a TIFF-F image.

The two step process to deliver T.37 faxes from OSCAR involves

  1. converting the OSCAR provided pdf to TIFF with ghostscript
  2. MIME encoding the tiff file and sending it to the T.37 compliant MFP

Document Version History

  • v1.0 – initial public release to – Dec 29, 2015
  • v1.1 – added debugging hints – Dec 30, 2015

development of this approach has greatly benefited from the work of Darius on whose work this document is based 

copyright ©2015 by Peter Hutten-Czapski MD under the Creative Commons Attribution-Share Alike 3.0 Unported License



  1. Preface
  2. Document Version History
  3. Prerequisites
  4. Installing Server Packages
  5. Now a Cron job
  6. Debugging


It is assumed that

  1. You have installed Oscar and configured it for faxing
  2. You have a T.37 compliant multifunction printer (MFP)
  3. You have a basic level of Linux knowledge
  4. You can open a Linux terminal
  5. You can cut and paste EXACTLY the following instructions

NOTE: Firefox will copy with Control+C while a Linux terminal requires Shift+Control+V for past

Installing Server Packages

Sendemail  is a command-line outgoing e-mail SMTP client written in PERL. It is used for sending e-mails from the command line.

Ghostscript is a pdf generating and manipulating program.  In this case we are using it to form TIFF-F files.

Install Sendemail and Ghostscript by typing or pasting the following into the command line.

sudo apt-get install sendemail ghostscript


Now a cron job

With the  deb installation OSCAR uses iText for prescriptions and wkhtmltopdf for eForms to generate pdf's for faxing.  These files are dropped   into /tmp/tomcat6-tmp with the image to be filed as the pdf and as matching txt files with the fax number.  These files can be parsed by a script that runs regularly, and assembled into an email that is sent to the MFP attached to your local network.

We don't recommend any MFP in particular, this protocol has been shown to work in principle with some Brother multifunction printers although most manufacturers provide this support for their MFP's.  Look for documentation specifying T.37 protocol support prior to purchase.

Save the following as gateway.cron. (note that you should check the path for the tmp file, it can be /tmp/tomcat6-tomcat6-tmp/)

# T.37 Fax cron
# Picks up the files dropped by OSCAR for faxing
# converts the pdf to a TIFF and sends to a MFP via T.37
# OSCAR and this file are on and the MFP is on listening on port 25
# Make sure you adjust the paths and URLs appropriately
if test -n "$(find /tmp/tomcat6-tomcat6-tmp -maxdepth 1 -name '*.txt' -print -quit)"; then 
	for f in `ls /tmp/tomcat6-tmp/*.txt`; do
		p = $f | sed s"/txt/pdf/"
		t = $f | sed s"/txt/tiff/"
		gs -q -sDEVICE=tiffg3 -r204x98 -dBATCH -dPDFFitPage -dNOPAUSE -sOutputFile=$t $p
		sendemail -f sender@ -t FAX=`sed s"/ *//g" $f|tr -d "\n"`@ -m fax -a $t -s
		rm $f; 
		rm $t; 
		rm $p;
Save the file with execution privileges.

You may then run the gateway.cron as a cron job with a user that can read and delete the files in the temp folder (by example the tomcat6 user)

thanks to Darius who developed this technique and Kevin Boyle who suggested it


The above cron job has not been tested in production beyond a proof in concept.

Configuring the MFP is beyond the scope of the tutorial and is device specific.  The T.37 functionality may be turned off by default, and you may need to set and specify the MPF's IP and port for SMTP. 

You do not need to debug on the OSCAR server.  The software that OSCAR often uses to generate pdf's (wkhtmltopdf) and those software described for the OSCAR server cron job (ghostscript, sendemail) are all available as programs that run on Windows(TM) and other operating systems. 


Document Actions