A recurring issue that comes up when migrating reports from an environment where it was normal to embed ESCAPE sequences directly in the print file (e.g. PRINT #CH, CHR(27);CHR(16);...) is how to do this in the Windows printing environment.

"Normal" Windows printing does not allow this kind of thing. Instead, Windows applications generate "logical" output (specifying fonts by name and attributes, using drawing primitives to create lines, boxes, colors, etc.) which the Windows printer drivers then render into printed output using the capabilities of the physical printer. In many cases, especially with ink jet and other low cost printers, this is done purely at the rasterization level, i.e. the printer itself only knows how to print dots, so the printer driver supplies with a rasterized version of the logical output. For these kinds of printers, there is no way to send them any kind of ESC codes that they will understand. Instead, you'll have to use PASSTHROUGH = OFF and GDI Printing Directives to exercise any control over the printing attributes. (This is the best approach for Windows printing in general, since it provides device independence and results in your application printing "like" other Windows applications do.)

Other printers, typically laser and dot matrix printers, have the ability to directly interpret escape codes according to some printer language, whether a standard like PCL or Postscript, or a manufacturer-specific language like EPSON and OKI have for simple printer settings like LPI, CPI, bold, etc. For these printers, you can continue to send them raw control codes if you like. In order to do so, you have to set the PASSTHROUGH option to ON (i.e. use raw printing mode).

In addition, you may need to use the Generic Text Only printer driver. Since raw printing is so unusual in the Windows world, many printer drivers simply fail to provide support for this printing mode at all. Fortunately, Microsoft provides a "Generic / Text Only" driver that does support raw passthrough printing, and that should work for any printer that can handle that type of printing. (This includes most dot matrix printers.)

Note that although you can switch between passthrough (raw) and normal (GDI) printing for successive print jobs sent to the same printer, there is no good way to switch in the middle of a printout. However, for GDI-mode reports, there is a GDI directive //ESCAPE which allows raw control codes to be sent within an otherwise GDI-mode report. (This is sometimes handy for selecting very specific printer capabilities for which there is no corresponding GDI directive. But again, it does require that the printer driver support the feature, and that's not a universal given.)

Also note: when having any difficulties with printer drivers, you should always check the manufacturer's web site to see if there is a driver update. Hard as it may be to believe, printer manufacturers rush these printer drivers to market, often with many bugs in them. But on the bright side, they tend to publish frequent patches/updates. In it not at all unusual for hours to be wasted trying to debug some printer feature, only to find that the latest version of the driver, which can be downloaded and installed in 5 minutes, fixes it.