Link to home
Start Free TrialLog in
Avatar of WiddleAvi
WiddleAvi

asked on

Using Printer Escape Codes

I am trying to use printer escape codes. I got a list of the escape codes from HP. Now how do I use them ?? Any help would be appreciated.

Thanks
Avatar of speedguns
speedguns

Well,  It depends on how you are planning on getting them to the printer.  But basically, you insert the codes into the data stream for the printer (usually an escape character is needed prior to the code.)   If you give an example of what you would like to do,  then perhaps someone here or myself,  will be able to help you out in greater detail.
Avatar of WiddleAvi

ASKER

o.k. I am sending info from my Palm Pilot (and Palm M100) to the printer using IR. The driver I am using is from Bachmannssoftware.com and it's called Printboy. The program I am using is Pendragon forms. In the prgoram I use scripts to tell it what to print and where on the page to print it but there is no option to change fonts etc. So I was hoping to put in escape codes to do that.
Basically, from olden days, you print one character at a time. <Escape> is merely character. It is followed by whatever else you need <char> to perform function. The you do the printout.

Implementation is another matter. Some used simple basic, even .bat.  Ideal is to find way to do once only, to last all day. Some just would create new file, add the escape codes, then add the text for printing. Then print the file. Each printout. Sometimes its the nature of printout, or printouts that may be done (ex: 80 columns all day long, or 132 cols all day long; vs. 80 then 130, then 80, then 130, etc., changing mind all time) sometimes its the equipment involved.

I know not of palm pilot, or Printboy, or Pendragon, (shame on them for not making it clear to you, though) so will drop off at that much, let someone else follow up here.
> I got a list of the escape codes from HP.

btw: each printer has own 'unique' set of codes. Do not expect your list to be common, ensure it.  In general tho', Centronics was standard, then Epson, so any list you have for them, for common functions, 'should' work most of the time, since they do try for a measure of compatibility. It would be the more 'modern' functions (codes) that would then be less compatible.

If you can hack, and get a simple to like basic lang, its real easy to just pump out some codes, watch printer, and see what result was, if anything, then take what works. Alternatively, if you can get a text file copied in, create the text file elsewhere, where you can have a text file generator like notepad or dos edit AND a hex editor, even a debug proggie that can handle non-text like escape.

The concept is to perform the kind of test a modern printer will do, where it displays a line in one font, then another. The trick for the hack is to prefix the line of each "A-Z" with (1) escape code, (2) escape char, (3) text chars you can read that tell you what ### was used in prior step #2. This can be done simple enough in Basic code, or similar, but I know not what else you got available, including skillset.
Avatar of schwertner
I often used the following way to command the printer via Escape sequences. I put the <Escape> character followed by the needed escape sequence directly in the text, using a simple text editor (like Notepad). Another way is to "print" a dedicated text file which turned the printer settings to the needid state. After that I printed the docs.
If you have the HP documentation follow the examples given in this documentation.

Sincerely
Schwertner
Subow
I have an HP Deskjet 350. All I really need is to be able to change the font to bold and then back. If someone can post an exact example of the code I would use I would appreciate it.

Thanks
Can you let us know the code for Bold,  and for Normal?  From your HP350 manual?  if it exists.
Changing font or heaviness - much difference. But good to have code for similar box.

speedguns, use any sampe character, no matter. Make one up. I ditto schwertner, SunBow, but someone needs the WiddleAvi tool to make it up.

Why not MS Debug? Everyone's got access to MS, right? Use free Notepad to make file. Use MS debug to edit file and TYPE OVER a couple characters to do the code. Save.

Now they are there where another proggie like notepad can move around, copy, like the test printout. Leave enough text so you can tell where is the characters, they look so different in attempt to display text, like garbage, but they are not corruption after all.

Take file, go print. done. Save file, take the chars and save them where you can find them later.

Better with prog language like basic, where it is easier to automate and put all in one place.
If it were serial, the way modems were accessed, this is more easily done with the windows interface. I have no Palm either, so I know not what, if any options it has.

Hey, try their website. If it can be done, it just has to be a FAQ, right? Go. Now.

For me, it is time for Holiday! You all enjoy it, you hear!
o.k. guys...from the HP document for this printer it lists 3 different escape codes
It says Printer command is: "Esc ( s 3 B"
It says the Decimal Value is "27 40 115 51 66"
And the Hexidecimal value is "1B 28 73 33 42"

Here is a link to that document http://www.hp.com/cposupport/printers/support_doc/bpd50034.html

The script for the program I am printing from goes like this:
printleft "Hello Everyone" 1 <-- The 1 tells it to print this starting from the first character of the line.

Now I tried using all 3 of the aboce codes before the quotation marks and right after and nothing worked.

Happy Holidays to all.
Hey guys. I am really desperate to get this solved. I tried putting the codes in a standard document and sent it to the printer but that didn't work. I would like to be able to manually in a regular text files use the escape codes to change to font to bold. Once I can do that then I will take the next stop and try and do it from the palm. Try and explain this to me as if you were talking to an idiot !! :-) Hope someone can help me.
Hi,

If you can use Visual Basic, you could
Open "LPT1" for Output as #1  
Print chr$(27) & Chr$(40) & Chr$(115) & Chr$(51) & Chr$(66);

I used to do this before Windows that now takes care of this code. Sorry, I don't have any Palm!

Enjoy
This person has been suspended for multiple violations of the Member Agreement, and will reject the proposed answer, and return your question to the Active Questions List.  The Moderator Group is deleting all 388 locked questions.

These were posted by three persons:

quirkyquirky
EliteKiller
liloXwin
 
Thank you,
ComTech
CS Admin @ EE
ASKER CERTIFIED SOLUTION
Avatar of nico5038
nico5038
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial