User Tools

Site Tools


how_to_print_to_a_file.htm
Navigation:  How To's and Troubleshooting > How to… >====== How to Print to a File ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

You can change the windows default printer without calling the PRINTERDIALOG function. This can be done by using Clarion's property syntax. The property to use is PROPPRINT:Device. This property definition can be found in ..\LIBSRC\WIN\PRNPROP.CLW. This must be included in your application before making use of any of the properties defined therein.

Install the Generic Printer Driver

1. Use the Control Panel, or Settings C6H0013.jpg Printers and Faxes from the Start Menu, then double-click on the Add Printer icon.

To include PRNPROP.CLW:

1.Select the Global Embeds tab on the Application Tree.

2.Select the After Global Includes embed point and add the following embedded source code:

INCLUDE('prnprop.clw')

To change the printer device:

1.From the Application Tree, select your target report procedure.

2.In the Data/Tables Pad, create a local data STRING variable named: SAV::Printer.

3.Press the Embeds button.

4.Select the ProcessManager Method Executable Code–Open (Priority:2500) embed point and add the following embedded source code:

SAV::Printer = PRINTER{PROPPRINT:Device}           !save windows default printer
PRINTER{PROPPRINT:Device} = 'Generic / Text Only   !set to ASCII device
PRINTER{PROPPRINT:PrintToFile} = TRUE              !print to file flag
PRINTER{PROPPRINT:PrintTo Name} = 'REPORT.TXT'     !set filename for report

At the end of the report, restore the original default printer:

1.From the Application Tree, select your target report procedure and press the Embeds button.

2.Select the ProcessManager Method Executable Code–Close (Priority:7500) embed point and add the following embedded source code:

PRINTER{PROPPRINT:Device} = SAV::Printer

PRINTER{PROPPRINT:PrintToFile} = FALSE     ! print to file flag

how_to_print_to_a_file.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1