Cicode Programming Reference > Cicode Function Categories > Window Functions Introduction > WinPrint

WinPrint

Sends the graphics image of the active window to a printer.

Notes:

Syntax

WinPrint(sPort [, xScale] [, yScale] [, bSwapBlackWhite] [, sMap] )

sPort:

The name of the printer port to which the window will be printed. This name needs to be enclosed within quotation marks "". For example "LPT1:", to print to the local printer, or "\\Pserver\canon1" using UNC to print to a network printer. sPort may not contain spaces.

xScale:

The x scaling factor for the print. The default value of 0 (zero) automatically scales the print to fit the page. A value of 1 is used to maintain the current horizontal scaling of the image. The outcome is proportional to 1; for example, 0.5 halves the width of the image (optional).

yScale:

The y scaling factor for the print. The default value of 0 (zero) automatically scales the print to fit the page. A value of 1 is used to maintain the current horizontal scaling of the image. The outcome is proportional to 1; for example, 0.5 halves the width of the image (optional).

bSwapBlackWhite:

Swaps the colors black and white for the purpose of printing pages with a lot of black content. Use the default value of 1 to swap black and white (optional).

sMap:

The file name or path of a text based map file used to specify colors to swap when printing. By default CitectSCADAwill look in the bin directory for the map file. The format for the map file is:

RRR GGG BBB RRR GGG BBB [HHH] [SSS] [LLL]//
RRR GGG BBB RRR GGG BBB [HHH] [SSS] [LLL]//

Where:

RRRis a decimal red intensity value between 000 and 255.

GGGis a decimal green intensity value between 000 to 255.

BBBis a decimal blue intensity value between 000 to 255.

HHH, SSS and LLL are optional tolerance values to enable swapping a range of colors. Default values are shown below.

HHH is a decimal value representing the Hue tolerance. Valid range is 0 to 360. Default = 0.

SSS is a decimal value representing the Saturation tolerance. Valid range is 0 to 255. Default = 2 * Hue tolerance.

LLL is a decimal value representing the Luminance tolerance. Valid range is 0 to 255. Default = 2 * Hue tolerance.

Leading zeros are not required, however they aid readability.

The first three RGB values specify the FROM color, and the second three RGB values specify the TO color. The tolerance values are applied to the FROM color when replacing individual pixels in the image.

Comments may be placed at the end of each line, or on individual lines, and needs to be proceeded with // or !.

Example map file to swap the CSV_Include project:

043 043 255 155 205 255 025 000 025 
//Change dark blue to light blue using Hue and Luminance tolerance of 25. (Converts the CSV title bar)
000 000 000 255 255 255 //Swap black to white with no tolerance

Note:If swap color ranges overlap, the behavior is undefined (i.e. a color that falls in both ranges may end up as either color)

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

WinPrintFile

Example

WinPrint("LPT3:",0,0,0);
! Prints the active window on printer "LPT3". The print will be scaled to fit the largest possible page area and will retain the orientation of the printer, aspect ratio and colors that are displayed on screen.
WinPrint("LPT3:");
!Prints the page as in the first example, but swaps black and white on the printout.

See Also

Window Functions