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

WinPrintFile

Prints a file to the system printer. The file needs to be saved with the WinFile() function.

Note: This function might not work as expected if called directly from the Kernel; if the WinFile function does not succeed, WinPrintFile either doesn’t print anything or prints a previously saved page. This function should be called from a graphics page.

Syntax

WinPrintFile(sFile, sPort [, xScale] [, yScale] [, bSwapBlackWhite] [, fromColor] [, toColor] )

sFile:

The file name.

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 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).

fromColor

The hex RGB color value (0xRRGGBB) to change into toColor. The default value of -1 results in no color change (optional).

toColor

The hex RGB color value (0xRRGGBB) into which fromColor is changed. The default value of -1 results in no color change (optional).

Note: To change a color, a value needs to be specified for both fromColor and toColor.

Return Value

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

Related Functions

WinPrint

Example

! Save image to disk then print.
WinFile("temp");
WinPrintFile("temp", "LPT3:",0,0,0);
! Prints the file "temp" 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.
WinPrintFile("temp","LPT3:");
! Prints the page as in the first example, but swaps black and white on the printout.
WinPrintFile("temp","LPT3:",0,0,0,0x00FF00,0xFF0000);
! Changes green to red.
WinPrintFile("temp","LPT3:",0,0,1,0x00FF00,0xFF0000);
! Changes green to red and black to white.

Window Functions