Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PCL command to printer in c#

Status
Not open for further replies.

gretious

Programmer
Feb 16, 2006
6
DE
hi i am doing a kiosk software for my company. i have never done pcl before so please forgive any mistaken i make. I am having problem writing a code to change the font size of a text in c#.

The printer i am using is a axiohm/tpg A794 thermal pos printer. i know that if i want to send a pcl code to the printer i have to use esc or for c# "x1b" then the pcl code and send it to the printer as a normal printer.

i wrote the code like this
"movie = "x1b* 21 62"
PrintDirect.WritePrinter(lhPrinter,movie,movie.Length,ref pcWritten);

movie = "hello world";
PrintDirect.WritePrinter(lhPrinter,movie,movie.Length,ref pcWritten);"

i noted that the first line which was suppose to send the font change code to the printer actually printed out the 1 62. i look throught the documentation and ask the tpg service support and i still have no idea why is that being printed the code is actually take from
hope someone can help with this
 
At a glance, you seem to be missing the leading "\" shown in the sample code. The link shows "\x1b" where you only show "x1b". This is certainly not a PCL issue, but rather the behavior of some piece of software.

If you actually did have the "\" in your code and it was stripped off by an outside agent, try doubling to "\\x1b" and see if the extra one gets through.

The only other thing I can think of is that you maybe have some misplaced quotes (") early in your code and it is not being interpreted properly.

Jim Asman
 
i did have the \ in the code i typed it in so i forgot to put it down in the forum

i just change this st1="\x1b*c600a6b0P"; to what i need. As today is a sat i cannot get access to that printer i will try the double \ when i get back. i doubt that its a misplaced quotes but i will double check to be sure thanks for the help tho i think i will very likely come back again
 
You might try entering it octal.

st1="\033*c600a6b0P"


Jim Asman
 
i try that too but it didn't work i tried ascII, hex and the rest.

it keeps printing out the last 3 digit.

werid isn't it and in "movie = "\x1b*21 62" the 21 62 was actually a code i got from "tpg" when i email them about it they say this should work. oh well i will give you back the reply about the \\ tomorrow
 
The sequence:
{esc}*21 62
where {esc} represents the escape character (the character with decimal code 27, or hexadecimal 1b, or octal 033) is not valid PCL.

Are you sure that this device (Axiohm/TPG A794) supports PCL? Or is it another (proprietary?) escape-based printer language.

I note that TPG offer a download of the A794 UserGuide (which should explain how to use/program/configure the device), but I haven't obtained this since (a) it's about 50MB in size and (b) you have to register to obtain it.

If you have a copy of this manual, perhaps you can post the relevant extract (for font selection) here so we can see just what the device expects.
 
It does beg the question...

Can the <esc> character be entered into the text directly? Many editors provide a mechanism to enter control characters as well as 8bit characters.

Jim Asman
 
well this is the part that you wanted to see i asked tpg about it and they point me to this. just to say this before hand i tried every and any combination and the result is almost the same either the last 3 digit is print or nothing happens

Select character size
ASCII GS ! n

Hexadecimal 1D 21 n

Decimal 29 33 n

Value of n: 1-8 = vertical number of times normal font

1-8 = horizontal number of times normal font

Range of n: 00-07, 10-17, ...70-77

Default of n: 11 hexadecimal

Selects the character height using bits 0 to 2 and selects the character width using bits 4 to 6, as follows:

Character Width Selection

Hex Decimal Width
00 0 1 (normal)
10 16 2 (two times width)
20 32 3 (three times width)
30 48 4 (four times width)
40 64 5 (five times width)
50 80 6 (six times width)
60 96 7 (seven times width)
70 112 8 (eight times width)

Character Height Selection
Hex Decimal Height
00 0 1 (normal)
01 1 2 (two times height)
02 2 3 (three times height
03 3 4 (four times height)
04 4 5 (five times height)
05 5 6 (six times height)
06 6 7 (seven times height)
07 7 8 (eight times height)

This command is effective for all characters (except for HRI characters).

In Standard Mode, the vertical direction is the paper feed direction, and the horizontal direction is perpendicular to

the paper feed direction. However, when character orientation changes in 90 degree clockwise-rotation mode, the

relationship between vertical and horizontal directions is reversed.

In Page Mode, vertical and horizontal directions are based on the character orientation. When characters are enlarged

with different sizes on one line, all the characters on the line are aligned at the baseline.

The Select Print Mode (1B 21 n) command can also select or cancel double-width and double-height modes. However,

the setting of the last received command is effective.

Exception

If n is out of the defined range, this command is ignored.
 
dunno how to edit the post anyway this is an example in basic. i learn alittle about basic a long time ago so i mostly forgotten about it. but what i know is that it just send the code into the printer using character if i am not wrong

Using BASIC to Send Commands
In BASIC, printer commands are sent as a string of characters that are preceded by the LPRINT command. For
example,
LPRINT CHR$(&H0A)
sends the hexadecimal number 0A to the printer, which causes the printer to print the contents of its print buffer.

Previously sent commands tell the printer exactly how this data should appear on the paper.

For example, LPRINT CHR$(&H12); "ABC"; CHR$(&H0A)

sends the hexadecimal numbers 12 41 42 43 0A to the printer. This causes the printer to set itself to double wide mode(12), load the print buffer with "ABC" (41 42 43), and finally, print (0A). again, the communication link that the BASIC program outputs to must be matched to that of the printer.
 
From your description of the "select character size" sequence, it is apparent that this is part of another printer language (perhaps proprietary) and not PCL.

The description indicates that the sequence:

hexadecimal (1D 21 11)

should result in double-height double-width characters (except for HRI characters, whatever they might be).


Also from your description:
"The Select Print Mode (1B 21 n) command can also select or cancel double-width and double-height modes."

But it is unclear from your description whether 'n' in this case takes the same values as for the "select character size" sequence?
If it does, then one might expect that the sequence:

hexadecimal (1B 21 11)

might also result in double-height double-width characters for following text.

I fail to see how this relates to your original:
x1b* 21 62
sequence, unless what it should have been is:
\x1b \x21 \x62
(i.e. all in hexadecimal, and with no "*" character), to select 7-times-width, triple-height characters.
 
Your axiohm/tpg A794 thermal control language uses ECS/POS and not PCL. Epson created this language for POS(point of sale) type of terminal/printer. Most of this control are in the motherboard and therefore can be controlled by buttons in the terminal. We have these on our hospitals and I believe our vendor used javapos to set controls on the printers.

You may be able to download the CL from Epson.
 
hmmm i am see. dansdaduk like i said this is my first time even touching a pos type printer. i just noted some of the similarity in the codes and some forums saying you can use pcl so i just gave it a try.

Not sure about the control on mboard and button on terminal jmanj. But i do know of POS from microsoft that didn't support the A794 printer. i will try it out with the cl and read up on javapos just incase.

thanks all for your help and sorry for causing any problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top