FaxMan SDK Version 4.7
How to Create Faxes


OK, now that you know all about sending and receiving faxes, you're probably beginning to wonder how to create them. Well, there are actually three ways of creating fax files which will work with FaxMan, and we'll cover each in detail below.


Option 1: Use the FaxCreate function

The FaxCreate function allows your application to easily convert monochrome TIFF, PCX/DCX, PDF*, BMP, and even text files into FaxMan fax format. You can combine as many of these files as you want in whatever order you wish into a single output file. The FaxCreate function will handle rasterizing text files into faxable pages, scaling down monochrome images that are too large to be faxed, and adding whitespace to the edges of any monochrome images that are too small to be faxed. It will also include all pages of a multiple-page input image in the output image. To combine multiple files, simply separate them with a '+' character, as shown in the example below:


WORD wResult;


wResult = FaxCreate(pInfo, "salesfig.pdf+mychart.tif+myscan.pcx", "outfax.fmf", 0L);

if (wResult) {

 // the FaxCreate failed. The return value wResult contains the

 // index of the input file which caused the problem.




Option 2: Use ImageMan to save a fax file directly

If you're using the ImageMan imaging library with FaxMan, you can use it to convert images of all types (not just monochrome) into FaxMan fax files. You can also use ImageMan to give your app access to a wider range of images for input, and a wider range of images for output also. Rotation, color reduction, color inversion, and scaling are some of the image manipulations possible with the ImageMan library. With ImageMan your application can create a comprehensive fax viewer and editor, giving you the ability to load, alter, and store fax images.


Option 3: Use the FaxMan printer driver to create faxes by printing from any Windows application

This is the option your users will probably utilize most often for creating faxes; it is by far the easiest to work with. You should take a moment to review the section on the FaxMan printer driver before continuing with this explanation.


To enable an application to work with the FaxMan printer driver, your application needs to do several things, as follows:


1) Install the printer driver for use with Windows


2) Add code to handle the communication with the printer driver. Since the communication will take place through the use of Windows SendMessage functions, you'll be adding code to the WM_FAXMSG handler in your app.


Since the first two items have previously been covered in this manual, we'll devote our attention to the third: how should your application respond to the print messages sent to your app by the printer driver?


The print driver will send notification messages to your application (if it's registered properly) at the end of printing. The message will notify your application of the status of the print job, including the number of pages generated and whether it completed successfully (the actual structure passed to your application is a PRINTSTAT structure). The following code shows how an application might respond to these messages:



// It assumed that this code is a part of your WM_FAXMSG handler.

// The case statements are part of a switch (wParam) statement.


case FAXPRINTMSG:  // this message is sent at print end time


 // The following code is extracted from the CPPTST C++

 // application. It uses the PRINTSTAT structure members

 // to display a dialog which allows the user to send the

 // fax immediately if they desire.


 ps = (PPRINTSTAT)lParam;

 if (ps) {

  SendDlg sd(AfxGetMainWnd());

  sd.sf.szFileList = new char[STRLEN(ps->FileName)+1];

  STRCPY(sd.sf.szFileList, ps->FileName);




As you can see, FaxMan gives your application considerable control over the creation and sending of faxes.


* Requires the optional PDF Import  Addon




© 2013 Data Techniques, Inc. All Rights Reserved.

Send comments on this topic.