Printing Text

Printing seems like a pretty trivial procedure. In fact, under DOS, it was. Unfortunately, under MS Windows you need special instructions and a fair amount of luck.

Visual Basic | Delphi


Visual Basic 6.0


Delphi 5.0

You must add printers to your uses clause.

You may want to add a TPrinterSetupDialog and a TPrintDialog to the form and attach them to menu options.

To print graphics that are re-sized to fit the page, see the TJpegImage example in the Delphi help. Note, however, that while Printer.Canvas.StretchDraw worked on my Windows 98 system, it does not work in Windows XP.

Metafiles are supposed to stretch better than images (they store drawing commands, not bitmaps). First create a TMetafile, then create a TMetafileCanvas which you draw on.

For more details, see Printing via the TPrinter Canvas.


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Languages / Printing.htm