问题
I've been given the task of converting a web page with a barcode to a one click label print. I've got jZebra up and running, but I have no idea where to get started as far as understanding how to write commands for a printer.
I've Google'd just about everything I can think of regarding this.
Basically, I am trying to understand this code:
applet.append("^XA^CF,0,0,0^PR12^MD30^PW800^PON^CI13\n");
// Draws a line. applet.append("^FO0,147^GB800,4,4^FS\n");
applet.append("^FO0,401^GB800,4,4^FS\n");
applet.append("^FO0,736^GB800,4,4^FS\n");
applet.append("^FO35,92^AdN,0,0^FWN^FH^FD^FS\n");
applet.append("^FO615,156^AdN,0,0^FWN^FH^FD(123) 456-7890^FS\n");
Does anyone have links to or information regarding what these characters / commands like "^FO0,401^GB800,4,4^FS" mean or do?
回答1:
After 9,000 hours in google:
Many card printers (such as Zebra or Eltron manufactured printers) need special RAW printer commands sent to them in order to perform certain functions (such as magnetic strip encoding or barcode printing). These RAW commands are usually sent as text in a proprietary syntax. This RAW syntax is specified by the printer manufacturer (usually in the form of a developer's manual). Syntax will vary drastically between printer manufacturers and printer models.
Emphasis is mine. Probably want to google for a developer's manual.
Source: http://code.google.com/p/jzebra/wiki/OldSummaryDoNotUse
回答2:
For zebra you this simple guide will help you. On this Zebra commands
N
q609
Q203,26
B26,26,0,UA0,2,2,152,B,"777777"
A253,56,0,3,1,1,N,"JHON3:16"
A253,26,0,3,1,1,N,"JESUSLOVESYOU"
A253,86,0,3,1,1,N,"TEST TEST TEST"
A253,116,0,3,1,1,N,"ANOTHER TEST"
A253,146,0,3,1,1,N,"SOME LETTERS"
P1,1
on JZebra
var applet = document.jzebra;
if (applet != null) {
applet.append("N\n");
applet.append("q609\n");
applet.append("Q203,26\n");
applet.append("B26,26,0,UA0,2,2,152,B,\"777777\"\n");
applet.append("A253,56,0,3,1,1,N,\"JHON3:16\"\n");
applet.append("A253,26,0,3,1,1,N,\"JESUSLOVESYOU\"\n");
applet.append("A253,86,0,3,1,1,N,\"TEST TEST TEST\"\n");
applet.append("A253,116,0,3,1,1,N,\"ANOTHER TEST\"\n");
applet.append("A253,146,0,3,1,1,N,\"SOME LETTERS\"\n");
applet.append("P1,1\n");}
Having clear this:
EPL is one command per line. A command starts out with a command identifier, typically a letter, followed by a comma-separated list of parameters specific to that command. You can look up each of these commands in the EPL2 programming documentation. Here’s an English-language version of the commands in the above example.
- Sending an initial newline guarantees that any previous borked command is submitted.
- [N] Clear the image buffer. This is an important step and generally should be the first command in any EPL document; who knows what state the previous job left the printer in.
- [q] Set the label width to 609 dots (3 inch label x 203 dpi = 609 dots wide).
- [Q] Set the label height to 203 dots (1 inch label) with a 26 dot gap between the labels. (The printer will probably auto- sense, but this doesn't hurt.)
- [B] Draw a UPC-A barcode with value "777777" at x = 26 dots (1/8 in), y = 26 dots (1/8 in) with a narrow bar width of 2 dots and make it 152 dots (3/4 in) high. (The origin of the label coordinate system is the top left corner of the label.)
- [A] Draw the text "JESUSLOVESYOU" at x = 253 dots (3/4 in), y = 26 dots (1/8 in) in printer font "3", normal horizontal and vertical scaling, and no fancy white-on-black effect.
All tha A starting lines are similar. 10. [P] Print one copy of one label.
来源:https://stackoverflow.com/questions/9282049/jzebra-getting-started-with-raw-commands