!PCL()

!PCL()

Top  Previous  Next

 

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.

 

 

Format

 

CALL !PCL(string, key, arg1,...)

 

where

 

stringis the returned control string.

 

keyidentifies the operation to be performed. See the PCL.H include record for the relationship between the key values and the functions described below.

 

arg1,...are arguments defining the exact action. The !PCL() subroutine takes a variable length argument list.

 

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 .

 

PCL.COPIES(copies)

Sets the number of copies to be printed.

 

PCL.CURSOR(x, y)

Sets the current cursor position to the given coordinates. Subsequent text output will occur at this point.

 

PCL.DUPLEX(mode)

Sets duplex mode. 0 = off, 1 = long edge binding, 2 = short edge binding.

 

PCL.FONT(font)

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.

Font names:ARIAL, COURIER, CG‑TIMES, LETTER‑GOTH, LINEPRINTER, UNIVERS
Character sets:ASCII, LATIN‑1, PC‑8, ROMAN‑8
Type style:UPRIGHT, COMPRESSED, CONDENSED, CONDENSEDITALIC, EXPANDED, INLINE, ITALIC, OUTLINE, OUTLINESHADOW, SHADOW
Weight:ULTRA‑THIN, EXTRA‑THIN, THIN, EXTRA‑LIGHT, LIGHT, DEMI‑LIGHT, SEMI‑LIGHT, MEDIUM, SEMI‑BOLD, DEMI‑BOLD, BOLD, EXTRA‑BOLD, BLACK, EXTRA‑BLACK, ULTRA‑BLACK
Spacing:FIXED, PROPORTIONAL
Size:nPT (point size), PITCH n (characters per inch)
Composite:REGULAR (equivalent to UPRIGHT, MEDIUM)

 

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.

 

PCL.LEFT.MARGIN(col)

Sets the left margin at column col.

 

PCL.ORIENTATION(layout)

Specifies the page format. The layout argument is a string and may be PORTRAIT or LANDSCAPE.

 

PCL.PAPER.SIZE(size)

Specifies the page size. The size argument is a string chosen from A3, A4, B5, C5, COM10, DL, EXECUTIVE, LEDGER, LEGAL, LETTER and MONARCH.

 

PCL.RESET()

Resets the printer.

 

PCL.RESTORE.CURSOR()

Restores a previously saved cursor position.

 

PCL.SAVE.CURSOR()

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.

 

 

Example

 

$INCLUDE PCL.H

PRINTER ON

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.