More about hex and printing and gdi printers...
palcibiades-first at yahoo.co.uk
Mon Dec 28 03:53:53 EST 2009
Just for the sake of completeness, something probably most people here know,
but in case some other luckless amateur ends up struggling with this again,
there is at least one other way of doing this.
The first way was to edit a text file using a hex editor, then use a shell
command that uses the Unix cat command to redirect the contents of the file
to the printer, in our case lp0.
A simpler method that clutters up the program directory a bit less, and
maybe is less open to user errors, because you don't have to have mysterious
text files lying around, is to use echo as in
echo -e "\x1B\x64\x30" > /dev/usb/lp0
Presumably this works with OSX as well. What is happening is that the -e
enables interpretation of the escaped character which follows, and the
escaped character x signals that the following pair is a hex character.
Anyway, do this with my particular printer, and the result is magic: the
paper cutter operates!
This is so simple, assuming you have the hex codes to do things, that one
starts having fantasies of writing very simple printer drivers in Bash. No,
that way madness lies!
View this message in context: http://n4.nabble.com/More-about-hex-and-printing-and-gdi-printers-tp963411p989668.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the Use-livecode