PCL command to printer in c#
PCL command to printer in c#
(OP)
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
http://w ww.c-sharp corner.com /Code/2002 /Oct/Print Direct.asp
hope someone can help with this
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
http://w
hope someone can help with this
RE: PCL command to printer in c#
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
RE: PCL command to printer in c#
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
RE: PCL command to printer in c#
st1="\033*c600a6b0P"
Jim Asman
RE: PCL command to printer in c#
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
RE: PCL command to printer in c#
{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.
RE: PCL command to printer in c#
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
RE: PCL command to printer in c#
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.
RE: PCL command to printer in c#
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.
RE: PCL command to printer in c#
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.
RE: PCL command to printer in c#
You may be able to download the CL from Epson.
RE: PCL command to printer in c#
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.