Applies To:
  • CitectSCADA 5.xx, 6.xx
  • CitectHMI 5.xx, 6.xx

I have configured a Printer device for my Reports but I want to be able to to dynamically change this printer at runtime. How do I do that?

You will need to use DevModify Cicode function to modify the Filename field of the Printer device. To make it even easier, you can pass in the FormSelectPrinter() cicode function as the Filename parameter which will allow you to choose a printer from a drop down list. Below is an example of this implementation:

1. Configure a generic Device as follows:


The above will ensure that a default printer (LPT1:) is always selected at start-up.

2. To change the printer used for this device, execute the following code:


As you can see, the above code calls the FormSelectPrinter Cicode function, which brings up printer selection box as shown below:

Once you have clicked OK, the device will now point to the newly selected printer. All the other device fields are left unchanged.