We help IT Professionals succeed at work.

Using Printer Escape Codes

WiddleAvi
WiddleAvi asked
on
I have an HP Deskjet 350 and I have a list of printer escape codes. Now I just need to know how to use them. I tried just typing in the escape code the way it's listed in the document but nothing happens. It just
prints out those Characters. Hope someone can help me with this.
Thanks
Comment
Watch Question

You can just create a pure ASCII file, such as a .TXT file, type in the sequence and send it to the printer port.

There's a lot of variations. Here you will find how to correctly use the Escape Codes:

http://www.hp.com/cposupport/printers/support_doc/bpd50034.html

Hope that it helps.
Best regards,

BBuster

Author

Commented:
I have that document already. But it was very unclear. For example the program I am printing from is called Pendragon Forms. And it is on the Palm Pilot. I downloaded drivers to print from the palm and that works. In the program I use scripts to tell it what to print and where on the page to print it. Here is an example of one line of the script:

printleft "Hello Everyone"
printline

Now accroding to the document you linked to the print code for bold is "Esc ( s 3 B"
So I tried putting it in like this

printleft "Esc ( s 3 BHello Everyone"
printline

and I tried like this

printleft Esc ( s 3 B "Hello Everyone"
printline

neither way worked. I also tried using the decimal value and the hexidecimal value but neither worked.

Commented:
For 'esc' you need to send the asci value of 27 not the letters 'esc'.

The sequence you are trying to send looks like this
27 40 115 51 66. That is decimal.

In hex it is 1b 28 73 33 42.

Here is a link to the ascii chart.
http://www.december.com/html/spec/ascii.html

Author

Commented:
joed
I tried that as well
here is the code I tried:

printleft "27 40 115 51 66 Hello Everyone"
printline

and I tried:

printleft "1B 28 73 33 42 Hello Evreryone"
printline

neither worked.
BRONZE EXPERT

Commented:
When you include "27 40 115 51 66" in quotes, the program will send those literally, since it doesn't know whether you want to send the ASCII codes or the actual numbers.

You need to find out how to imbed an ASCII code into a string. I am not familiar with Pendragon Forms, but here are a few things I would try:

1) printleft CHR$(27) + CHR$(40) + CHR$(115) + CHR$(51) + CHR$(66) + "Hello Everyone"

2) Same as #1, but use CHR(x) instead of CHR$(x)

3) printleft "\\027\\040\\115\\051\\066Hello Everyone"

--
Troy
BRONZE EXPERT

Commented:
I checked with Pendragon Software's tech support. The response I got was:

"Yes, you can use escape codes in your printing scripts. An example can be seen at the bottom of page 178. You would just enter the "\\013" or whichever escape code in the printleft statement."

So, just use

printleft "\\027\\040\\115\\051\\066Hello Everyone"

Keep in mind that you do NOT want to put spaces between the codes, unless the code specifically requires a space. A space between the codes will be sent to the printer, and if the space is not expected, it will not work.

--
Troy
Asta CuTechnical consultant & graphic design
BRONZE EXPERT
Top Expert 2004

Commented:
Have you been helped here or is more needed?

If you've been helped, please convert that Expert's comment to the Accepted Answer to grade and close this.

If more is needed, please tell us.  I am willing to help you here, but not if this is no longer a need.

If Asker does not respond in 7 days, Experts, please post closing recommendations.

If you found/posted your own solution, please post that solution here and request a refund/PAQ in the Community Support with a zero point question (include this link).

Thanks,
":0) Asta
Your Question needs  to be awarded  points and  closed,  Please  be fair  to all  who may have helped in Anyways.

If you've been helped, please convert that Expert's comment to the Accepted Answer to grade and close this.

If more is needed, please tell us.

If Asker does not respond in 7 days, Experts, please post closing recommendations.

If you found/posted your own solution, please post that solution here and request a refund/PAQ in the Community Support with a zero point question


MRFIXITPC
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[Accept answer  PAQ  no refund]
Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

[MRFIXITPC]
EE Cleanup Volunteer
Commented:
PAQed - no points refunded (of 100)

PashaMod
Community Support Moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.