NOTICE: Our Community is moving. Get more information.
This sample program demonstrates the capability of printing "raw" data to a printer under Windows. This is a new feature of Visual COBOL 2.0 and is supported for managed code only. This feature is enabled by adding the following two run-time tunables to the managed code
app.config file of your project:
add key="printer_redirection" value="true" add key="printer_raw_redirection" value="true"
The printer_redirection tunable by itself causes all output sent to a file defined as PRINTER in the select statement to be redirected to the Windows Print Spooler. This output will then be sent to whatever is defined as your default printer under Windows. A different printer can also be selected by adding the following tunable to app.config: add key="printer_defaults" value="printer.name=\\mypc\myprinter"
The printer name can also be selected dynamically by using the library routine PC_PRINTER_SET_DEFAULT.
When setting the printer_raw_redirection tunable also, data will be sent to the default printer as "RAW" data which means you can embed Printer Control Language (PCL) esc sequences directly in your text in order to control advanced printer features and formatting on printers that support PCL.
The attached sample will open the default printer and send a couple of lines of formatted text to be printed. If you wish to dynamically set the printer name then uncomment out the perform to the 100-set-default-printer paragraph and provide your printer name in the pd-printer-name variable in working-storage.
The support for printing RAW data is only enabled in managed code .NET programs and is not supported directly in native programs. Also see PC_PRINT_FILE documentation for use with new RAW printing flag.