FaxMan Jr
Receiving Faxes

Receiving faxes with the FaxMan Jr Faxing class is very easy.

 

  1. Create an instance of the Faxing control
  2. Set the Modem property to the modem you wish to use
    You can set the Modem property to a Modem object from the Modems collection or by creating a Modem object manually.
  3. Set the ReceiveDir property to the directory where received faxes should be stored
    This directory should exist and your application must have read/write/modify permissions in that directory.
  4. Use the Receive method or the Listen method and FaxRing Event.
    Both options allow you to receive a fax but with slightly different options. When your application calls the Receive method it passes the number of rings to wait before answering and control is returned to your application. The FaxMan Jr control is listening for a call on a background thread and will start to fire events when a call comes in. The FaxSetStartTime, FaxSetPages, FaxStatus,  FaxReceiveFileName, FaxNegotiatedParameters and FaxSetEndTime events will fire while the fax is being received and the FaxCompletionStatus event will fire at the end of the fax indicating if it was received successfully or not.

    Calling the Listen method will cause the control to listen for Rings from the modem and fire a FaxRing event when it gets one. Your application can then set the Action property of the FaxRingArgs object to pickup the call and begin receiving or to stop listening. If your app sets the Action to ReceiveFax then FaxMan will pickup the call and start receiving and firing the same events as if the Receive method had been called.

 

The received fax will be stored in a multi page tiff file in the directory specified by the ReceiveDir property. The name is automatically generated by FaxMan and will be returned to your application in the FaxReceiveFileName event and also in the Fax object passed to the FaxCompletionStatus event. Your application can rename the file any time after the FaxCompletionStatus event has fired.

Because received files may have some image coding inconsistencies which may cause some image viewers to fail to display the image, your application can use the ImportFiles method to clean the received file. This can be done in your FaxCompletionStatus event handler.

 

Receiving a Fax with C#

Faxing faxman = new Faxing();

 

faxman.Modem = new Modem(3, FaxClass.Class20); // Use COMM3 and Class 2.0

faxman.Receive( 2 ); //Wait 2 Rings before picking up

 

Receiving a Fax with VB.Net

Dim faxman As Faxing = New Faxing()

 

faxman.Modem = New Modem(3, FaxClass.Class20)        ' Use COMM3 and Class 2.0

faxman.Receive(2)           ' Wait 2 Rings before picking up

See Also

 

 


© 2014 Data Techniques, Inc. All Rights Reserved.

Send comments on this topic.