EPL 命令简单解释
最近使用条码打印机需要用到EPL语言,整理一下,使用EPL不需要打印驱动,打印控制到点阵,非常精确,最初使用Msbarcode9.ocx,显示没有问题,但打印的是空白,考虑到打印的精确调整使用EPL,网上没有PB的例子,我把PowerBuilder的代码整理如下:
string ls_print,ls_file
integer li_FileNum
ls_file = g_curr_path + '\' + 'ean13.prn'
if fileexists(ls_file) then
filedelete(ls_file)
end if
li_FileNum = FileOpen(ls_file, LineMode!, Write!, LockWrite!, Append!)
ls_print = char(13) + char(10)
ls_print = ls_print + 'N' + char(13) + char(10)
ls_print = ls_print + 'Q200,24' + char(13) + char(10)
ls_print = ls_print + 'D10' + char(13) + char(10)
ls_print = ls_print + 'ZT' + char(13) + char(10)
ls_print = ls_print + 'S2' + char(13) + char(10)
ls_print = ls_print + 'B44,15,0,E30,3,6,142,B,"'+string(dw_3.object.upc[1])+'"' + char(13) + char(10)
ls_print = ls_print + 'P1' + char(13)
FileWrite(li_FileNum, ls_print)
FileClose(li_FileNum)
Run("prt.bat", Minimized!)
解释:
<回车> | 此行为激活命令 |
N<回车> | 清除缓冲区 |
Q240,24<回车> | 设置标签长度和间距, 长度=240dots=30mm,间距=24dots=3mm |
D10<回车> | 设置打印深度为10 |
ZB<回车> | 打印方向为旋转180度 |
S2<回车> | 打印速度为2,范围2-4 |
B240,80,0,E30,3,6,126,B,"123456789012"<回车> |
例范围为1-9;参数N为普通打印,如为R则为反转打印;“1234567890123”为打印内容
打印条码,240,80为X,Y坐标点;0为条码方向正向;E30为EAN13码;3,6为条码的细条宽度,粗条宽度; 126为条码高度;B表示打印条码下方字符;“123456789012”为打印内容,注意EAN13码最后一位自动生成
|
P1<回车> | 打印,1为打印数量 |
EPL2命令说明
EPL2严格区分大小写
A
语法 Ap1,p2,p3,p4,p5,p6,p7,“DATA”
参数 p1=以象素点为单位的水平起始位置
p2=以象素点为单位的垂直起始位置
p3=旋转
Value Description
0 No rotation
1 90 degrees
2 180 degrees
3 270 degrees
4 No rotation
5 90 degrees
6 180 degrees
7 270 degrees
4-7是针对亚洲字体的设置
p4=字体选择
Value Description
203 dpi 300 dpi
1 20.3 cpi, 6 pts, 25 cpi, 4 pts,
(8 x 12 dots) (12 x 20 dots)
2 16.9 cpi, 7 pts, 18.75 cpi, 6 pts,
(10 x 16 dots) (16 x 28 dots)
3 14.5 cpi, 10 pts, 15 cpi, 8 pts,
(12 x 20 dots) (20 x 36 dots)
4 12.7 cpi, 12 pts, 12.5 cpi, 10 pts,
(14 x 24 dots) (24 x 44 dots)
5 5.6 cpi, 24 pts, 6.25 cpi, 21 pts,
(32 x 48 dots) (48 x 80 dots)
6 Numeric Only Numeric Only
(14 x 19 dots) (14 x 19 dots)
7 Numeric Only Numeric Only
(14 x 19 dots) (14 x 19 dots)
亚洲打印机
Simplified Chinese, Japanese, Korean
8 203 dpi fonts : 24 x 24 dots
300 dpi Double-byte fonts : 36 x 36 dots
300 dpi Single-byte fonts : 24 x 36 dots
Traditional Chinese, Japanese
9 300 dpi Double-byte fonts: 36 x 36 dots
300 dpi Single-byte fonts : 24 x 36 dots
Korean - Reserved
p5=水平膨胀,值:1-6&8
p6=垂直膨胀,值:1-9
p7=N代表普通,R表示反转图象
"DATA"=数据
B
用于打印标准条码
语法:Bp1,p2,p3,p4,p5,p6,p7,p8,“DATA”
参数 p1=以象素点为单位的水平起始位置
p2=以象素点为单位的垂直起始位置
p3=旋转
Value Description
0 No rotation
1 90 degrees
2 180 degrees
3 270 degrees
p4=条码选择,参见条码表
p5=窄条的象数宽度,参见条码表
p6=宽条的象数宽度,参见条码表
p7=条码的象素高度
p8=打印可读代码,值 B=是,N=否
"DATA"=数据
条码表
BarCode |
De scrip tion |
P4 Value |
P5 Value |
P6 Value |
Code 39 std. or extended |
3 |
1-10 |
Y |
|
Code 39 with check digit |
3C |
1-10 |
N |
|
Code 93 |
9 |
1-10 |
N |
|
Code 128 UCC Serial Shipping Container Code |
0 |
1-10 |
N |
|
Code 128 auto A, B, C modes |
1 |
1-10 |
N |
|
Code 128 mode A |
1A |
1-10 |
N |
|
Code 128 mode B |
1B |
1-10 |
N |
|
Code 128 mode C |
1C |
1-10 |
N |
|
Code 128 with Deutsche Post check digit4 |
1D |
2-10 |
N |
|
Codabar |
K |
1-10 |
Y |
|
EAN8 |
E80 |
2-4 |
N |
|
EAN8 2 digit add-on |
E82 |
2-4 |
N |
|
EAN8 5 digit add-on |
E85 |
2-4 |
N |
|
EAN13 |
E30 |
2-4 |
N |
|
EAN13 2 digit add-on |
E32 |
2-4 |
N |
|
EAN13 5 digit add-on |
E35 |
2-4 |
N |
|
German Post Code |
2G |
3-4 |
N |
|
Interleaved 2 of 5 |
2 |
1-10 |
Y |
|
Interleaved 2 of 5 with mod 10 check digit |
2C |
1-10 |
Y |
|
Interleaved 2 of 5 with human readable check digit |
2D |
1-10 |
Y |
|
Postnet 5, 9, 11 & 13 digit1 |
P |
? |
N |
|
Planet 11 & 13 digit1 |
PL |
? |
N |
|
Japanese Postnet3 |
J |
? |
? |
|
UCC/EAN 1282 |
1E |
1-10 |
N |
|
UPC A |
UA0 |
2-4 |
N |
|
UPC A 2 digit add-on |
UA2 |
2-4 |
N |
|
UPC A 5 digit add-on |
UA5 |
2-4 |
N |
|
UPC E |
UE0 |
2-4 |
N |
|
UPC E 2 digit add-on |
UE2 |
2-4 |
N |
|
UPC E 5 digit add-on |
UE5 |
2-4 |
N |
|
UPC Interleaved 2 of 5 |
2U |
1-10 |
Y |
|
Plessey (MSI-1) with mod. 10 check digit |
L |
? |
? |
|
MSI-3 with mod. 10 check digit |
M |
? |
? |