Faxes with special symbols and international characters using APRO's fax-printer driver
When you use the TApdFaxConverter component to convert a text file to an APF (our fax format), you get to choose one of two fonts, large and small. This works under most circumstances. However, the two fonts in Async Professional do not support many of the characters used in countries outside the U.S. We are looking at providing support for TrueType fonts in a future version. In the meantime, if you have a text file you need to convert that has one or more unsupported characters, there is a way to create a fax and have the characters you want by using the Async Professional Printer Driver and Delphi's Printers unit.

TPrinter to the Rescue
The TPrinter unit in Delphi is a great addition over the old days of printing in Windows. It creates a printer object with a canvas to which you can print just as you would paint to the canvas of other Delphi components.

In addition, TPrinter lets you to set the font, not only the type but also the size and style as well. When you print to the printer object, it goes to the default printer. If that default printer is the Async Professional printer driver, then the result is an APF file instead of a piece of paper.

The following code segment shows how you might print the lines of a TMemo to the printer. If you set the default printer in Windows to the Async Professional printer driver and select a font that supports the character set you want, you will have a fax ready to send.

procedure TForm1.Button1Click(Sender: TObject);
var
  I : longint;
  F : TextFile;
begin
  AssignPrn(F);
  Rewrite(F);
  try
    with Printer do begin
      Canvas.Font.Name := 'Arial';
      Canvas.Font.Size := 14;

      for I := 0 to TFE1.Lines.Count-1 do
        writeln(F, TFE1.Lines[I]);
    end;
    ShowMessage('Done');
  finally
    CloseFile(F);
  end;
end;

Of course, you're not limited to printing from a TMemo. If you have a text file, you could read it line by line, sending each line to the TPrinter object.

Since the Printer has a Canvas property, you can use any of the methods of the TCanvas class to add more to your fax than just text, e.g., lines, boxes, or maybe even an image. We'll save that example for another Tech Tip.

This site is not affiliated, endorsed, or otherwise associated with the entity formerly known as TurboPower Software. The owners and maintainers of Aprozilla.com were merely meager employees of the aforementioned organization, providing this site out of the pure goodness of their collective hearts. SourceForge.net Logo

Last updated: July 22, 2003.