I need to write a program to draw a graph using HP PCL 5e / HP / GL2

I read the example and tried to duplicate its methods, but with unusual results. This is a one-time deal, so I don't want to buy a package for this. In addition, it will be executed in the Multi-Valued database in Basic, which not many programmers do. If anyone can post a small example of this it would be very helpful. Specifically, I need a box of 8 '' paper with the left 1/3 filled in green, the center 1/3 in yellow, and the last 1/3 in red. Then draw a line through 3 dots in each window color.

Thank.

0


source to share


2 answers


Problem solved: The mistake in my thinking was that it was the difference between 300 dpi and 600 dpi, so I divided by 2 and the answer turned out to be almost correct. The real problem was the difference between 3 DPI and 720 Decipoints. The real factor should be 2.4 and it works great now.



0


source


The easiest way is to draw 3 windows. You will need to place each one as you see fit, doing your own math to figure out where to start the first one, so that it is centered, etc.

First, place your cursor in the upper left corner of the first window, draw it, move it to the upper left of the next box, draw it, and do the same for the last one. Here's some code:

<esc>&u300D<esc>*t300R<esc>*p300x300Y<esc>*r3U<esc>*v2S<esc>*c300a300b5P<esc>*p600x300Y<esc>*r3U<esc>*v3S<esc>*c300a300b5P<esc>*p900x300Y<esc>*r3U<esc>*v1S<esc>*c300a300b5P

      

Here's an explanation:



<esc>&u300D<esc>*t300R -- set the Unit of Measure and Resolution (in this case 300 dpi)
<esc>*p300x300Y -- move cursor to 300x 300y (1 inch x 1 inch) 
<esc>*r3U<esc>*v2S -- set the color palette to RGB and use color 2 (green)
<esc>*c300a300b5P -- draw a box that is 300 wide and 300 tall, use current fill pattern
<esc>*p600x300Y -- move cursor to 600x 300y
<esc>*r3U<esc>*v3S -- set the color palette to RGB use color 3 (yellow)
<esc>*c300a300b5P -- draw a box that is 300 wide and 300 tall, use current fill pattern
<esc>*p900x300Y -- move cursor to 900x 300y
<esc>*r3U<esc>*v1S -- set the color palette to RGB use color 1 (red)
<esc>*c300a300b5P -- draw a box that is 300 wide and 300 tall, use current fill pattern

      

Here are other colors and palettes, keep in mind that this is an easy way, you can specify your own RGB, etc.

RGB Palette
<esc>*r3U<esc>*v1S - Red                
<esc>*r3U<esc>*v2S - Green
<esc>*r3U<esc>*v3S - Yellow
<esc>*r3U<esc>*v4S - Blue
<esc>*r3U<esc>*v5S - Magenta
<esc>*r3U<esc>*v6S - Cyan

CMYK Palette
<esc>*r-3U<esc>*v1S - Cyan
<esc>*r-3U<esc>*v2S - Magenta
<esc>*r-3U<esc>*v3S - Blue
<esc>*r-3U<esc>*v4S - Yellow
<esc>*r-3U<esc>*v5S - Green
<esc>*r-3U<esc>*v6S - Red
<esc>*r-3U<esc>*v7S - Black

      

+1


source







All Articles