The !PCL () subroutine constructs PCL control strings for various useful operations. It is intended for use as a series of functions defined in the SYSCOM PCL.H include record.
CALL !PCL(string, key, arg1,...)
The !PCL() subroutine should be called using the function interfaces defined below. The returned string can be sent to a PCL compatible printer to perform the requested action.
All page positioning values are measured using the PCL coordinate grid where (0,0) is at the top left of the page and the grid scale is 300 per inch. There is a useful grid template printing program, PCL.GRID, in the BP file of the QMSYS account.
Note: The quality of PCL implementations varies widely and these functions may not give the expected results on some printers. In particular, setting some font metrics may cause inconsistent character placement. It is the application developer's responsibility to ensure that the printed results are acceptable.
The following functions are defined in the SYSCOM PCL.H include record. Each returns the relevant control string to perform its action.
PCL.BOX(left, top, width, height, pen.width, radius)
Draws a rectangular box using the given position (left, top) and size (width, height) values. The pen.width determines the width of the lines used to draw the box. The radius value determines the radius of rounded corners. A value of zero results in square corners .
Sets the number of copies to be printed.
Sets the current cursor position to the given coordinates. Subsequent text output will occur at this point.
Sets duplex mode. 0 = off, 1 = long edge binding, 2 = short edge binding.
Sets the font details for text output. The font argument consists of comma separated list of case insensitive items chosen from the following list. Features that are not specified retain their previous values. Not all printers support all options.
PCL.HLINE(x, y, length, pen.width)
Draws a horizontal line starting at the given position and extending to the right, using the specified length and pen.width values.
Sets the left margin at column col.
Specifies the page format. The layout argument is a string and may be PORTRAIT or LANDSCAPE.
Specifies the page size. The size argument is a string chosen from A3, A4, B5, C5, COM10, DL, EXECUTIVE, LEDGER, LEGAL, LETTER and MONARCH.
Resets the printer.
Restores a previously saved cursor position.
Saves the current cursor position. Note that there is a limit to the number of nested cursor save operations.
PCL.VLINE(x, y, length, pen.width)
Draws a vertical line starting at the given position and extending downwards, using the specified length and pen.width values.
The source version of the !PCL() subroutine is in the BP file of the QMSYS account so that users can add further options. A copy of any changes should be retained as this item will be replaced when an upgrade is installed.
PRINT PCL.RESET() :
PRINT PCL.FONT('Courier, Pitch 10, Regular') :
PRINT PCL.BOX(300,300,300,100,2,15) :
PRINT PCL.CURSOR(350, 380) : 'Hello' :
The above program prints the word Hello in a box with rounded corners.