ESC/P programming! - delphi

Why i need to use it is because for some printers using TPrinter prints some weird hieroglyph at the beginning of the printable area.
My problem is that if i send some commands, nothing happens.
ESC E (#27 #69) - Sending this escape sequence didn't work as i expected. It removed first letter and rest of the string made bold. eg. Hello -> ello. After i changed it to ESC E ESC (#27 #69 #27), it worked fine. This example i managed to figure out, but...
trying to select character table "ESC t n" (#27 #116 n), to make "õäöü" work. This command just doesn't work. Nothing happens! And this command is supported by esc/p, esc/p 2 and 9-pin esc/p, so it should work just fine.
Manual can be found here.
If anyone has ever needed to use esc/p commands then maybe one can shed some light how to work with them!
Thanks in advance!
EDIT:
In my previous post i asked more or less the same question though answers were about how did i send commands to the printer. (I'll change my question there according to what was the answers!)
I accepted Ken's answer, because he claimed that the way i transferred the commands wasn't the best and i got it to work with Escape command.
The problem was that after trying to use my program with another printer, it didn't work as expected, because it uses TPrinter.Begindoc and EndDoc.
So actually i must use the other solution that Rob Kennedy helped me with!
EDIT 2:
As it turned out, i used wrong manual, where commands are little different (though still supporting esc/p as it proclaims). Thank you all for your help!
PS!
I still have a question: I need a character table where
245 = õ
228 = ä
246 = ö
252 = ü
which is iso 8859. But in manual there is no such character table or any similar to it. Should i do some string manipulation and replace eg 228 to 132 or does anyone know any better approuch?
I keep it unanswered for a while, and then accept stukelly's answer.

Based on your previous question, I think you are using the wrong commands to control the EPSON TM-T70 receipt printer. After some research I found the product brochure and POSMicro both mention ESC/POS.
The ESC/POS command for turning bold on and off requires has a third value, as follows.
ASCII ESC E n
Hex 1B 45 n
Decimal 27 69 n
Where n is 0 or 1, turning bold off or on.
Here is a detailed ESC/POS reference.

Related

Geany doesn't print a few combination of characters

I just got Geany 1.36 and everything was working fine until I tried to type a "-". It turns out Geany doesn't print characters like "." , "-" , "<", ",". I have to type an extra character to get it to show. It seems like it stores it in a buffer and when I type an extra character it prints both characters at once.
Also, character combinations like (. + s), (. + r), (. + t) doesn't print at all.
I changed the font settings, (can this be the reason?) but then I reinstalled Geany again and I still have this issue.
(I cleaned the preference files from APPDATA too)
I searched the entire net, even looked through Geany manual but couldn't find anything.
If you know anything about this do let me know.
I am running Windows 10 and Geany 1.36.
GNU programs don't work properly if the keyboard layout is not set up correctly.
Make you sure you set up the keyboard layout correctly, for the majority of the people it should be EN-US
Search for Edit keyboard and layout options and make sure it is set up to EN-US (or whatever the correct one is)

ZPL command barcode 3 zeros creates issues

I am trying to print to a GT800 Zebra printer thru serial port.
I am using ZPL. I want to control the width which is fine in auto mode. To address that in the >^BC> command I am using Auto mode as no other size setting under ^BY works
Following is the code
^XA
^MMT
^PW831
^LL400
^LS0
^BY2,,76^FT225,141^BCN,76,Y,Y,N,A
^FD:RNIP29200082034^FS
^FO225,157^A#N,18,10,E:CAL002.FNT^FD26030-0892R^FS
^FO383,157^A#N,18,10,E:CAL002.FNT^FD08.01.20 12:00PM^FS
^FO225,187^A#N,18,10,E:CAL002.FNT^FDLAMP-DR RH^FS
^FO453,187^A#N,18,10,E:CAL002.FNT^FDXBA3^FS
^PQ1,0,0,Y
^XZ
There is a funny problem. If the ^BC mode = A then if three zeros come together gives issues for eg ABCD29200082034 it prints ABCD29200 and does not complete the barcode. But the other lines are getting printed. But if the data is ABCD29200182034 , there are no issues.
If BC mode = U then even if the code is ABCD29200182034 it prints 292001820347. Note 7 is added in the end.
I am clueless as to what is this issue. I remember facing this same issue in Honeywell printer too once.
Thanks
NOTE : I replaced the 000 with 111 and the problem persists.
ZPL Manual says the following
A= Automatic Mode :This analyzes the data sent and automatically determines the best packing method. The full ASCII character set can be used in the ^FD
statement — the printer determines when to shift subsets. A string of
four or more numeric digits causes an automatic shift to Subset C.
Note , it says a string of four or more numeric digits causes an automatic shift to subset C, but when the same string is 290010 it has no issues. I am really lost

How do you define the length of a parameter in ESC/POS?

I need to be able to print Hebrew characters on my Epson TM-T20ii. I am trying to get my printer to switch to character code page 36(PC862) using
ESC t36
for some reason the printer is switching to code page 3 and then printing the number 6.
Is there a way to let the printer know that the 6 is part of my command?
If you know of a different workaround please comment below.
Thanks
You are making a mistake, you aren't meant to replace n with an actual number.
The proper syntax in your case would be ←t$
Explanation: the manual says "ESC t n", n referring to the page sheet, however you don't replace n with a number rather with the ASCII character n, so in your example 36 = $ because $ is the 36th character on the ASCII table.

What's wrong with this regular expression containing math symbols? (Ruby/Rails)

text.scan(/\"[\d\w\s\+\-\*\/]*\"/)
I'm simply looking to find any thing within quotations that can contain letters, numbers, spaces, plus, minus, star, or forward slash. Everything works great in console. Each of the following works in a browser:
"abc"
"123"
"x-1" or "x - 1"
"x/1" or "x / 1"
But the plus sign and star fail in a browser (despite working fine in console with the same regex). Does anyone have any ideas?
Edit #1: I'm performing a quick gsub to add some formatting to the results of the scan. If the quotations have a plus or star in them, they don't even get picked up by the scan. The same code and text pasted in console works just fine.
Edit #2: I figured out a better way to frame this question without extraneous details and got the answer. "Why can't I perform a gsub on each of the results from a scan if the result contains regex special characters?"
Turned out that this problem was related to regexp string insertion (/#{whatever}/) not escaping special characters - manually escaping clears it up (/#{Regexp.escape(whatever)}/). See this question for a full example/explanation.
I don't know what do you mean "work in browser" but I'm making an assumption that you're trying to parse an URL. In URL the + & * signs can be converted to %2B & %2A respectively.
Try this regexp:
/"[(\d\w\s\+\-\*\/|%2B|%2A)]+"/
...or decode URL before parsing.

.gsub erroring with non-regular character 194

I've seen this posted a couple of times but none of the solutions seem to work for me so far...
I'm trying to remove a spurious  character from a string...
e.g.
"myÂstring here Â$100"
..but it should be my string here $100
I've tried:
string.gsub(/\194/,'')
string.gsub(194.chr,'')
string.delete 194.chr
All of these still leave the  intact..
Any thoughts?
By default, Rails supports UTF-8.
You can use your favorite editor to write a gsub call using the proper character you want to replace, as in:
"myÂstring here Â$100".gsub(/Â/,"")
If this does not work as well, you might be having an encoding error somewhere on your stack, probably on your HTML document. Try running rails console, extract somehow that string (if it comes from the Model, try to perform a find on the containing class) and run the gsub. It won't solve your problem, but you'll get a clue to where exactly the problem may lie.
Looks like a character encoding problem to me. For every Unicode code point in the range U+0080..U+00BF inclusive, the UTF-8 encoding is a two-byte sequence, 0xC2 (194 decimal) and the numeric value the code point. For example, a non-breaking space--U+00A0--becomes 0xC2 0xA0. Was there another extra character in there, that you already removed?
At any rate, gsub(/\194/,'') is wrong. \nnn is supposed to be an octal escape, but the number is in its decimal form. 194 in octal is \302.
"myÂstring here Â$100".gsub("Â","") # "mystring here $100"
Is that what you meant?

Resources