An Introduction to HP-GL/2 Graphics
=========================================
What is HP-GL/2?
Vector graphics uses less memory than raster graphics, when being stored, as
well as having a more efficient Input/Output transfer of large images when
printing, (it will print faster). When printing in HP-GL/2, the printer will define
points "a" and "b" then draw a line between them, in raster the printer defines
every point between point "a" and point "b".
HP-GL/2 History
HP-GL/2 was added to the PCL language in PCL Level 5, for LaserJet III
family printers and is supported in LaserJet 4 family printers with PCL Level 5
Enhanced. To print in HP-GL/2 you are required to leave the PCL environment
and enter the HP-GL/2 environment. Switching into and out of HP-GL/2
requires only a few commands, and cannot be done through the front menu
panel. Some software applications may easily switch between the two modes as
needed without affecting performance.
Learning HP-GL/2
The best way to learn HP-GL/2 is to read the "Introduction to HP-GL/2
Graphics" in the PCL 5 Printer Language Technical Reference Manual for an
overview of HP-GL/2. Then find the specific commands you need in subsequent
chapters. Reading through the examples, then trying to print them using a text
editor or programming language is the best way to learn HP-GL/2.
------------------------------------------------------------------------------------------------
---------------------------
Absolute Arc Three Point (AT) Command
=========================================
The AT command is Absolute Arc Three Point, and draws an arc segment, using
absolute coordinates, from a starting point, through an intermediate point, to an
end point. For more information see the PCL 5 Printer Language Technical
Reference Manual.
LEGEND: Ec = [Ctrl] [P] [Esc] in DOS EDIT
EcE Resets the printer.
Ec%0B Enters HP-GL/2 mode.
IN; Initializes HP-GL/2 mode.
SP1; Selects pen number 1 (black). Even though there is no physical pen, the
SP command must be used to enable printing.
PA1000,100;PD2500,100; Specifies (1000,100) as the starting location, places
the pen down, and draws a line to (2500,100).
PU650,1150;PD1000,1150; Lifts the pen up and moves to (650,1150),
then places the pen down and draws a line to (1000,1150).
PU650,450;PD1000,450; Lifts the pen up and moves to (650,450) then places
the pen down, and draws a line to (1000,450).
PU1000,100;PD1000,1500,2500,1500; Lifts the pen up and moves to
(1000,100), then places the pen down and draws a line to (1000,1500), then
draws a line to (2500,1500).
AT3200,800,2500,100; Prints an arc, starting at the current pen position
(25,1500), passing through (3200,800) and ending at (2500,100).
PU3200,900;PD; Lifts the pen and moves it to (3200,900), and sets the pen
down.
AT3300,800,3200,700; Prints an arc, starting at the current pen position,
passing through (3300,800) and ending at (3200,700).
PU3300,800;PD3500,800; Lifts the pen to (3300,800) and then puts the pen
down and draws a line to (3500,800).
Ec%0A; Enters PCL mode.
EcE Sends a reset to end the job and eject the page.
------------------------------------------------------------------------------------------------
------------------------
Absolute Character Size (SI) Command
=========================================
The Absolute character Size (SI) command, specifies the size of labeling
characters in centimeters. For more information see the Updated PCL 5 Printer
Language Technical Reference Manual. The syntax for this command is as
follows:
SI width, height; or SI;
LEGEND: Ec = [Ctrl] [P] [Esc] in DOS EDIT.
EcE Resets the printer.
Ec%0B Enters HP-GL/2 mode.
IN; Initializes HP-GL/2 mode.
SP1; Selects pen number 1, (black). Even though there is no physical pen,
the SP command must be used to enable printing.
PA700,3000; Enters absolute plotting mode and moves to (700,3000).
DT#; Defines the label terminator as the "#" character.
LBPrint#; Prints the word "Print" in the default font.
PA700,2000;SI1,1.5;LBPrint#; Moves to (700,2000); specifies an absolute
character size of 1 cm wide by 1.5 cm high; prints the word "Print".
SI; Send SI with no parameters to return to the default size.
SD1,21,2,1,4,12,5,0,6,0,7,
4148;SS; Designates a 12 point Universe font and selects it.
PA 4000,3000;LBPrint#; Moves to (4000,3000) and prints the word "Print" in
the 12 point Universe font.
PA4000,2000;SI1,1.5;LBPrint#; Moves the pen to (4000,2000) and specifies
a character size of 1 cm by 1.5 cm; prints the word "Print".
Ec%0A Enters PCL mode.
EcE Sends a reset to end the job and eject the page.
------------------------------------------------------------------------------------------------
---------------------------
Anchor Corner (AC) Command
=========================================
The AC command positions the starting point of any fill pattern. By using this
command you ensure that the selected fill pattern is positioned as expected
within the figure. For more information see the PCL 5 Printer Language
Technical Reference Manual.
LEGEND: Ec = [Ctrl] [P] [Esc] in DOS EDIT.
EcE Resets the printer.
Ec%0B Enters HP-GL/2 mode.
IN; Initializes HP-GL/2 mode.
SP1; Selects pen number 1, (black). Even though there is no physical pen,
the SP command must be used to enable printing.
PA3000,3000; Specifies absolute plotting and moves to location (3000,3000).
FT3,400,45;RR1000,1000;
ER1000,1000; Specifies a fill type of number 3 (parallel lines), with each line
400 plotter units (plu) apart and set at a 45 degree angle. RR fills a rectangle
using the current pen location as the lower left corner, and a point 1000 plu to
the right and 1000 plu up as the upper right corner. The ER edges the same
rectangle just filled.
PR1000,0;FT4,400,45;RR1000,
1000;ER1000,1000; Moves 1000 plu to the right, andselects fill type 4
(cross-hatch); then draws a rectangle the same size as the first one, and fills it
with the cross-hatch pattern just specified, then edges it with the ER command.
PR1000,0;FT3,400,45;
RR1000,1000;ER1000,1000; Moves to the right another 1000 plu, and
creates another rectangle of the same size, then fills this one with the number 3
fill pattern again. Then edges the rectangle just specified.
PA3000,1500;AC3000,1500;
RR1000,1000;ER1000,1000; Moves the pen to absolute position
(3000,1500), and moves the anchor corner to location (3000,1500). Fills a
rectangle with the fill pattern selected (number 3 from the command above), and
edges it.
PA4000,1500;AC4000,1500;
FT4,400,45;RR1000,1000,
ER1000,1000; Moves to location (4000,1500) andspecifies the location as the
anchor corner. Selects fill type number 4 again, then fills, and edges a rectangle.
PA5000,1500;AC5000,1500;
FT3,400,45;RR1000,1000;
ER1000,1000; Moves to absolute location (5000,1500)and specifies that
location as the anchor corner, then selects fill type 3 again, and fills and edges
another rectangle.
Ec%0A Enters PCL mode.
EcE Sends a reset to end the job and eject the page.
NOTE Due to space limitations these lines of code appear on more than one
line. When entered into the DOS editor they should appear on one line.
------------------------------------------------------------------------------------------------
---------------------------
Bezier Absolute (BZ) Command
=========================================
The BZ command or Bezier Absolute command draws bezier curves using
absolute coordinates. It uses the current pen position as the first control point,
and specifies the oth
- 1
- 2
前往页