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

?

?


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM