rghost_barcode 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rghost_barcode.rb +7 -5
- data/lib/rghost_barcode/ps/barcode_base.ps +17090 -0
- data/lib/rghost_barcode/rghost_barcode_adapter.rb +22 -226
- data/lib/rghost_barcode/rghost_barcode_base.rb +12 -14
- data/lib/rghost_barcode/rghost_barcode_types.rb +86 -0
- data/lib/rghost_barcode/rghost_barcode_version.rb +2 -2
- metadata +30 -177
- data/lib/doc/classes/RGhost.html +0 -109
- data/lib/doc/classes/RGhost/Barcode.html +0 -147
- data/lib/doc/classes/RGhost/Barcode/Auspost.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Azteccode.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Base.html +0 -266
- data/lib/doc/classes/RGhost/Barcode/Base.src/M000004.html +0 -34
- data/lib/doc/classes/RGhost/Barcode/Base.src/M000005.html +0 -30
- data/lib/doc/classes/RGhost/Barcode/Base.src/M000006.html +0 -20
- data/lib/doc/classes/RGhost/Barcode/Border.html +0 -170
- data/lib/doc/classes/RGhost/Barcode/Border.src/M000001.html +0 -27
- data/lib/doc/classes/RGhost/Barcode/Code11.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Code128.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Code2of5.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Code39.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Code93.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Datamatrix.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Ean13.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Ean2.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Ean5.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Ean8.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Guard.html +0 -174
- data/lib/doc/classes/RGhost/Barcode/Guard.src/M000003.html +0 -27
- data/lib/doc/classes/RGhost/Barcode/Interleaved2of5.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Isbn.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Kix.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Maxicode.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Msi.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Onecode.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Parameter.html +0 -262
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000007.html +0 -20
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000008.html +0 -18
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000009.html +0 -18
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000010.html +0 -18
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000011.html +0 -18
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000012.html +0 -24
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000013.html +0 -18
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000014.html +0 -18
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000015.html +0 -16
- data/lib/doc/classes/RGhost/Barcode/Pdf417.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Pharmacode.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Plessey.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Postnet.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Qrcode.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Rationalizedcodabar.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Raw.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Royalmail.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Rss14.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Rssexpanded.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Rsslimited.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Symbol.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Text.html +0 -193
- data/lib/doc/classes/RGhost/Barcode/Text.src/M000002.html +0 -30
- data/lib/doc/classes/RGhost/Barcode/Upca.html +0 -113
- data/lib/doc/classes/RGhost/Barcode/Upce.html +0 -113
- data/lib/doc/classes/RGhost/Config.html +0 -150
- data/lib/doc/classes/RGhost/Config.src/M000016.html +0 -45
- data/lib/doc/classes/RGhost/Document.html +0 -704
- data/lib/doc/classes/RGhost/Document.src/M000017.html +0 -19
- data/lib/doc/classes/RGhost/Document.src/M000018.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000019.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000020.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000021.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000022.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000023.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000024.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000025.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000026.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000027.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000028.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000029.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000030.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000031.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000032.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000033.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000034.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000035.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000036.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000037.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000038.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000039.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000040.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000041.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000042.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000043.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000044.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000045.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000046.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000047.html +0 -18
- data/lib/doc/classes/RGhost/Document.src/M000048.html +0 -18
- data/lib/doc/created.rid +0 -1
- data/lib/doc/files/rghost_barcode/rghost_barcode_adapter_rb.html +0 -101
- data/lib/doc/files/rghost_barcode/rghost_barcode_base_rb.html +0 -101
- data/lib/doc/files/rghost_barcode/rghost_barcode_classes_rb.html +0 -101
- data/lib/doc/files/rghost_barcode/rghost_barcode_examples_rb.html +0 -101
- data/lib/doc/files/rghost_barcode/rghost_barcode_version_rb.html +0 -101
- data/lib/doc/files/rghost_barcode_rb.html +0 -111
- data/lib/doc/files/teste_main_rb.html +0 -110
- data/lib/doc/fr_class_index.html +0 -67
- data/lib/doc/fr_file_index.html +0 -33
- data/lib/doc/fr_method_index.html +0 -74
- data/lib/doc/index.html +0 -24
- data/lib/rghost_barcode/ps/auspost.ps +0 -192
- data/lib/rghost_barcode/ps/azteccode.ps +0 -357
- data/lib/rghost_barcode/ps/barcode_template.eps +0 -1193
- data/lib/rghost_barcode/ps/code11.ps +0 -128
- data/lib/rghost_barcode/ps/code128.ps +0 -121
- data/lib/rghost_barcode/ps/code2of5.ps +0 -106
- data/lib/rghost_barcode/ps/code39.ps +0 -109
- data/lib/rghost_barcode/ps/code93.ps +0 -117
- data/lib/rghost_barcode/ps/datamatrix.ps +0 -328
- data/lib/rghost_barcode/ps/ean13.ps +0 -183
- data/lib/rghost_barcode/ps/ean2.ps +0 -101
- data/lib/rghost_barcode/ps/ean5.ps +0 -116
- data/lib/rghost_barcode/ps/ean8.ps +0 -101
- data/lib/rghost_barcode/ps/interleaved2of5.ps +0 -132
- data/lib/rghost_barcode/ps/isbn.ps +0 -118
- data/lib/rghost_barcode/ps/kix.ps +0 -98
- data/lib/rghost_barcode/ps/maxicode.ps +0 -307
- data/lib/rghost_barcode/ps/msi.ps +0 -104
- data/lib/rghost_barcode/ps/onecode.ps +0 -276
- data/lib/rghost_barcode/ps/pdf417.ps +0 -428
- data/lib/rghost_barcode/ps/pharmacode.ps +0 -69
- data/lib/rghost_barcode/ps/plessey.ps +0 -121
- data/lib/rghost_barcode/ps/postnet.ps +0 -114
- data/lib/rghost_barcode/ps/qrcode.ps +0 -530
- data/lib/rghost_barcode/ps/rationalizedcodabar.ps +0 -117
- data/lib/rghost_barcode/ps/raw.ps +0 -35
- data/lib/rghost_barcode/ps/render.ps +0 -307
- data/lib/rghost_barcode/ps/render.ps~ +0 -308
- data/lib/rghost_barcode/ps/royalmail.ps +0 -119
- data/lib/rghost_barcode/ps/rss14.ps +0 -237
- data/lib/rghost_barcode/ps/rssexpanded.ps +0 -211
- data/lib/rghost_barcode/ps/rsslimited.ps +0 -191
- data/lib/rghost_barcode/ps/symbol.ps +0 -49
- data/lib/rghost_barcode/ps/upca.ps +0 -128
- data/lib/rghost_barcode/ps/upce.ps +0 -157
- data/lib/rghost_barcode/rghost_barcode_classes.rb +0 -96
- data/lib/rghost_barcode/rghost_barcode_examples.rb +0 -35
- data/lib/teste_main.rb +0 -94
@@ -1,128 +0,0 @@
|
|
1
|
-
|
2
|
-
% --DESC: Code 11
|
3
|
-
% --EXAM: 0123456789
|
4
|
-
% --EXOP: includetext includecheck includecheckintext
|
5
|
-
% --RNDR: renlinear
|
6
|
-
/code11 {
|
7
|
-
|
8
|
-
0 begin % Confine variables to local scope
|
9
|
-
|
10
|
-
/options exch def % We are given an option string
|
11
|
-
/useropts options def
|
12
|
-
/barcode exch def % We are given a barcode string
|
13
|
-
|
14
|
-
/includecheck false def
|
15
|
-
/includetext false def
|
16
|
-
/includecheckintext false def
|
17
|
-
/textfont /Courier def
|
18
|
-
/textsize 10 def
|
19
|
-
/textyoffset -7 def
|
20
|
-
/height 1 def
|
21
|
-
|
22
|
-
% Parse the input options
|
23
|
-
options {
|
24
|
-
token false eq {exit} if dup length string cvs (=) search
|
25
|
-
true eq {cvlit exch pop exch def} {cvlit true def} ifelse
|
26
|
-
} loop
|
27
|
-
|
28
|
-
/textfont textfont cvlit def
|
29
|
-
/textsize textsize cvr def
|
30
|
-
/textyoffset textyoffset cvr def
|
31
|
-
/height height cvr def
|
32
|
-
|
33
|
-
% Create an array containing the character mappings
|
34
|
-
/encs
|
35
|
-
[ (111131) (311131) (131131) (331111) (113131)
|
36
|
-
(313111) (133111) (111331) (311311) (311111)
|
37
|
-
(113111) (113311)
|
38
|
-
] def
|
39
|
-
|
40
|
-
% Create a string of the available characters
|
41
|
-
/barchars (0123456789-) def
|
42
|
-
|
43
|
-
/barlen barcode length def % Length of the code
|
44
|
-
|
45
|
-
includecheck {
|
46
|
-
barlen 10 ge {
|
47
|
-
/sbs barlen 6 mul 24 add string def
|
48
|
-
/txt barlen 2 add array def
|
49
|
-
} {
|
50
|
-
/sbs barlen 6 mul 18 add string def
|
51
|
-
/txt barlen 1 add array def
|
52
|
-
} ifelse
|
53
|
-
} {
|
54
|
-
/sbs barlen 6 mul 12 add string def
|
55
|
-
/txt barlen array def
|
56
|
-
} ifelse
|
57
|
-
|
58
|
-
% Put the start character
|
59
|
-
sbs 0 encs 10 get putinterval
|
60
|
-
|
61
|
-
/checksum1 0 def /checksum2 0 def
|
62
|
-
|
63
|
-
/xpos 8 def
|
64
|
-
0 1 barlen 1 sub {
|
65
|
-
/i exch def
|
66
|
-
% Lookup the encoding for the each barcode character
|
67
|
-
barcode i 1 getinterval barchars exch search
|
68
|
-
pop % Discard true leaving pre
|
69
|
-
length /indx exch def % indx is the length of pre
|
70
|
-
pop pop % Discard seek and post
|
71
|
-
/enc encs indx get def % Get the indxth encoding
|
72
|
-
sbs i 6 mul 6 add enc putinterval % Put encoded digit into sbs
|
73
|
-
txt i [barcode i 1 getinterval xpos textyoffset textfont textsize] put
|
74
|
-
0 1 5 { % xpos+=width of the character
|
75
|
-
/xpos exch enc exch get 48 sub xpos add def
|
76
|
-
} for
|
77
|
-
/checksum1 checksum1 barlen i sub 1 sub 10 mod 1 add indx mul add def
|
78
|
-
/checksum2 checksum2 barlen i sub 9 mod 1 add indx mul add def
|
79
|
-
} for
|
80
|
-
|
81
|
-
% Put the checksum and end characters
|
82
|
-
includecheck {
|
83
|
-
/checksum1 checksum1 11 mod def
|
84
|
-
barlen 10 ge {
|
85
|
-
/checksum2 checksum2 checksum1 add 11 mod def
|
86
|
-
sbs barlen 6 mul 6 add encs checksum1 get putinterval
|
87
|
-
sbs barlen 6 mul 12 add encs checksum2 get putinterval
|
88
|
-
includecheckintext {
|
89
|
-
txt barlen [barchars checksum1 1 getinterval xpos textyoffset textfont textsize] put
|
90
|
-
/enc encs checksum1 get def
|
91
|
-
0 1 5 { % xpos+=width of the character
|
92
|
-
/xpos exch enc exch get 48 sub xpos add def
|
93
|
-
} for
|
94
|
-
txt barlen 1 add [barchars checksum2 1 getinterval xpos textyoffset textfont textsize] put
|
95
|
-
} {
|
96
|
-
txt barlen [() xpos textyoffset textfont textsize] put
|
97
|
-
txt barlen 1 add [() xpos textyoffset textfont textsize] put
|
98
|
-
} ifelse
|
99
|
-
sbs barlen 6 mul 18 add encs 11 get putinterval
|
100
|
-
} {
|
101
|
-
sbs barlen 6 mul 6 add encs checksum1 get putinterval
|
102
|
-
includecheckintext {
|
103
|
-
txt barlen [barchars checksum1 1 getinterval xpos textyoffset textfont textsize] put
|
104
|
-
} {
|
105
|
-
txt barlen [() xpos textyoffset textfont textsize] put
|
106
|
-
} ifelse
|
107
|
-
sbs barlen 6 mul 12 add encs 11 get putinterval
|
108
|
-
} ifelse
|
109
|
-
} {
|
110
|
-
sbs barlen 6 mul 6 add encs 11 get putinterval
|
111
|
-
} ifelse
|
112
|
-
|
113
|
-
% Return the arguments
|
114
|
-
/retval 8 dict def
|
115
|
-
retval (ren) (renlinear) put
|
116
|
-
retval (sbs) [sbs {48 sub} forall] put
|
117
|
-
retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
|
118
|
-
retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
|
119
|
-
includetext {
|
120
|
-
retval (txt) txt put
|
121
|
-
} if
|
122
|
-
retval (opt) useropts put
|
123
|
-
retval
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
} bind def
|
128
|
-
/code11 load 0 1 dict put
|
@@ -1,121 +0,0 @@
|
|
1
|
-
|
2
|
-
% --DESC: Code 128
|
3
|
-
% --EXAM: ^104^102Count^0990123456789^101!
|
4
|
-
% --EXOP: includetext
|
5
|
-
% --RNDR: renlinear
|
6
|
-
/code128 {
|
7
|
-
|
8
|
-
0 begin % Confine variables to local scope
|
9
|
-
|
10
|
-
/options exch def % We are given an option string
|
11
|
-
/useropts options def
|
12
|
-
/barcode exch def % We are given a barcode string
|
13
|
-
|
14
|
-
/includetext false def % Enable/disable text
|
15
|
-
/textfont /Courier def
|
16
|
-
/textsize 10 def
|
17
|
-
/textyoffset -7 def
|
18
|
-
/height 1 def
|
19
|
-
|
20
|
-
% Parse the input options
|
21
|
-
options {
|
22
|
-
token false eq {exit} if dup length string cvs (=) search
|
23
|
-
true eq {cvlit exch pop exch def} {cvlit true def} ifelse
|
24
|
-
} loop
|
25
|
-
|
26
|
-
/textfont textfont cvlit def
|
27
|
-
/textsize textsize cvr def
|
28
|
-
/textyoffset textyoffset cvr def
|
29
|
-
/height height cvr def
|
30
|
-
|
31
|
-
% Create an array containing the character mappings
|
32
|
-
/encs
|
33
|
-
[ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
|
34
|
-
(122312) (132212) (221213) (221312) (231212) (112232) (122132)
|
35
|
-
(122231) (113222) (123122) (123221) (223211) (221132) (221231)
|
36
|
-
(213212) (223112) (312131) (311222) (321122) (321221) (312212)
|
37
|
-
(322112) (322211) (212123) (212321) (232121) (111323) (131123)
|
38
|
-
(131321) (112313) (132113) (132311) (211313) (231113) (231311)
|
39
|
-
(112133) (112331) (132131) (113123) (113321) (133121) (313121)
|
40
|
-
(211331) (231131) (213113) (213311) (213131) (311123) (311321)
|
41
|
-
(331121) (312113) (312311) (332111) (314111) (221411) (431111)
|
42
|
-
(111224) (111422) (121124) (121421) (141122) (141221) (112214)
|
43
|
-
(112412) (122114) (122411) (142112) (142211) (241211) (221114)
|
44
|
-
(413111) (241112) (134111) (111242) (121142) (121241) (114212)
|
45
|
-
(124112) (124211) (411212) (421112) (421211) (212141) (214121)
|
46
|
-
(412121) (111143) (111341) (131141) (114113) (114311) (411113)
|
47
|
-
(411311) (113141) (114131) (311141) (411131) (211412) (211214)
|
48
|
-
(211232) (2331112)
|
49
|
-
] def
|
50
|
-
|
51
|
-
% Create a string of the available characters for alphabets A and B
|
52
|
-
/barchars ( !"#$%&'\(\)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~) def
|
53
|
-
/barlen barcode length def % Length of the code
|
54
|
-
/sbs barlen 6 mul string def % sbs is 6 times length of barcode
|
55
|
-
/txt barlen array def
|
56
|
-
|
57
|
-
/mode -1 def % A=0, B=1, C=2
|
58
|
-
/checksum barcode 1 3 getinterval cvi def % Initialise the checksum
|
59
|
-
|
60
|
-
/i 0 def /j 0 def
|
61
|
-
{ % loop
|
62
|
-
i barlen eq {exit} if
|
63
|
-
barcode i 1 getinterval (^) eq {
|
64
|
-
% indx is given by the next three characters
|
65
|
-
/indx barcode i 1 add 3 getinterval cvi def
|
66
|
-
txt j [( ) j 11 mul textyoffset textfont textsize] put
|
67
|
-
/i i 4 add def
|
68
|
-
} {
|
69
|
-
% indx depends on the mode
|
70
|
-
mode 2 eq {
|
71
|
-
/indx barcode i 2 getinterval cvi def
|
72
|
-
txt j [barcode i 2 getinterval j 11 mul textyoffset textfont textsize] put
|
73
|
-
/i i 2 add def
|
74
|
-
} {
|
75
|
-
barchars barcode i 1 getinterval search
|
76
|
-
pop % Discard true leaving pre
|
77
|
-
length /indx exch def % indx is the length of pre
|
78
|
-
pop pop % Discard seek and post
|
79
|
-
txt j [barchars indx 1 getinterval j 11 mul textyoffset textfont textsize] put
|
80
|
-
/i i 1 add def
|
81
|
-
} ifelse
|
82
|
-
} ifelse
|
83
|
-
/enc encs indx get def % Get the indxth encoding
|
84
|
-
sbs j 6 mul enc putinterval % Put encoded digit into sbs
|
85
|
-
|
86
|
-
% Update the mode
|
87
|
-
indx 101 eq indx 103 eq or {/mode 0 def} if
|
88
|
-
indx 100 eq indx 104 eq or {/mode 1 def} if
|
89
|
-
indx 99 eq indx 105 eq or {/mode 2 def} if
|
90
|
-
|
91
|
-
/checksum indx j mul checksum add def % checksum+=indx*j
|
92
|
-
/j j 1 add def
|
93
|
-
} loop
|
94
|
-
|
95
|
-
% Put the checksum character
|
96
|
-
/checksum checksum 103 mod def
|
97
|
-
sbs j 6 mul encs checksum get putinterval
|
98
|
-
|
99
|
-
% Put the end character
|
100
|
-
sbs j 6 mul 6 add encs 106 get putinterval
|
101
|
-
|
102
|
-
% Shrink sbs and txt to fit exactly
|
103
|
-
/sbs sbs 0 j 6 mul 13 add getinterval def
|
104
|
-
/txt txt 0 j getinterval def
|
105
|
-
|
106
|
-
% Return the arguments
|
107
|
-
/retval 8 dict def
|
108
|
-
retval (ren) (renlinear) put
|
109
|
-
retval (sbs) [sbs {48 sub} forall] put
|
110
|
-
retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
|
111
|
-
retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
|
112
|
-
includetext {
|
113
|
-
retval (txt) txt put
|
114
|
-
} if
|
115
|
-
retval (opt) useropts put
|
116
|
-
retval
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
} bind def
|
121
|
-
/code128 load 0 1 dict put
|
@@ -1,106 +0,0 @@
|
|
1
|
-
|
2
|
-
% --DESC: Code 25
|
3
|
-
% --EXAM: 01234567
|
4
|
-
% --EXOP: includetext includecheck includecheckintext
|
5
|
-
% --RNDR: renlinear
|
6
|
-
/code2of5 {
|
7
|
-
|
8
|
-
% Thanks to Michael Landers
|
9
|
-
|
10
|
-
0 begin % Confine variable to local scope
|
11
|
-
|
12
|
-
/options exch def % We are given an option string
|
13
|
-
/useropts options def
|
14
|
-
/barcode exch def % We are given a barcode string
|
15
|
-
|
16
|
-
/includecheck false def
|
17
|
-
/includetext false def % Enable/disable text
|
18
|
-
/includecheckintext false def
|
19
|
-
/textfont /Courier def
|
20
|
-
/textsize 10 def
|
21
|
-
/textyoffset -7 def
|
22
|
-
/height 1 def
|
23
|
-
|
24
|
-
% Parse the input options
|
25
|
-
options {
|
26
|
-
token false eq {exit} if dup length string cvs (=) search
|
27
|
-
true eq {cvlit exch pop exch def} {cvlit true def} ifelse
|
28
|
-
} loop
|
29
|
-
|
30
|
-
/textfont textfont cvlit def
|
31
|
-
/textsize textsize cvr def
|
32
|
-
/textyoffset textyoffset cvr def
|
33
|
-
/height height cvr def
|
34
|
-
|
35
|
-
% Create an array containing the character mappings
|
36
|
-
/encs
|
37
|
-
[ (1111313111) (3111111131) (1131111131) (3131111111)
|
38
|
-
(1111311131) (3111311111) (1131311111) (1111113131)
|
39
|
-
(3111113111) (1131113111) (313111) (311131)
|
40
|
-
] def
|
41
|
-
|
42
|
-
% Create a string of the available characters
|
43
|
-
/barchars (0123456789) def
|
44
|
-
|
45
|
-
/barlen barcode length def % Length of the code
|
46
|
-
|
47
|
-
includecheck {
|
48
|
-
/sbs barlen 10 mul 22 add string def
|
49
|
-
/txt barlen 1 add array def
|
50
|
-
} {
|
51
|
-
/sbs barlen 10 mul 12 add string def
|
52
|
-
/txt barlen array def
|
53
|
-
} ifelse
|
54
|
-
|
55
|
-
% Put the start character
|
56
|
-
sbs 0 encs 10 get putinterval
|
57
|
-
|
58
|
-
/checksum 0 def
|
59
|
-
|
60
|
-
0 1 barlen 1 sub {
|
61
|
-
/i exch def
|
62
|
-
% Lookup the encoding for the each barcode character
|
63
|
-
barcode i 1 getinterval barchars exch search
|
64
|
-
pop % Discard true leaving pre
|
65
|
-
length /indx exch def % indx is the length of pre
|
66
|
-
pop pop % Discard seek and post
|
67
|
-
/enc encs indx get def % Get the indxth encoding
|
68
|
-
sbs i 10 mul 6 add enc putinterval % Put encoded digit into sbs
|
69
|
-
txt i [barcode i 1 getinterval i 14 mul 10 add textyoffset textfont textsize] put
|
70
|
-
barlen i sub 2 mod 0 eq {
|
71
|
-
/checksum checksum indx add def
|
72
|
-
} {
|
73
|
-
/checksum checksum indx 3 mul add def
|
74
|
-
} ifelse
|
75
|
-
} for
|
76
|
-
|
77
|
-
% Put the checksum and end characters
|
78
|
-
includecheck {
|
79
|
-
/checksum 10 checksum 10 mod sub 10 mod def
|
80
|
-
sbs barlen 10 mul 6 add encs checksum get putinterval
|
81
|
-
sbs barlen 10 mul 16 add encs 11 get putinterval
|
82
|
-
includecheckintext {
|
83
|
-
txt barlen [barchars checksum 1 getinterval barlen 14 mul 10 add textyoffset textfont textsize] put
|
84
|
-
} {
|
85
|
-
txt barlen [( ) barlen 14 mul 10 add textyoffset textfont textsize] put
|
86
|
-
} ifelse
|
87
|
-
} {
|
88
|
-
sbs barlen 10 mul 6 add encs 11 get putinterval
|
89
|
-
} ifelse
|
90
|
-
|
91
|
-
% Return the arguments
|
92
|
-
/retval 8 dict def
|
93
|
-
retval (ren) (renlinear) put
|
94
|
-
retval (sbs) [sbs {48 sub} forall] put
|
95
|
-
retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
|
96
|
-
retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
|
97
|
-
includetext {
|
98
|
-
retval (txt) txt put
|
99
|
-
} if
|
100
|
-
retval (opt) useropts put
|
101
|
-
retval
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
} bind def
|
106
|
-
/code2of5 load 0 1 dict put
|
@@ -1,109 +0,0 @@
|
|
1
|
-
|
2
|
-
% --DESC: Code 39
|
3
|
-
% --EXAM: THIS IS CODE 39
|
4
|
-
% --EXOP: includetext includecheck includecheckintext
|
5
|
-
% --RNDR: renlinear
|
6
|
-
/code39 {
|
7
|
-
|
8
|
-
0 begin % Confine variables to local scope
|
9
|
-
|
10
|
-
/options exch def % We are given an option string
|
11
|
-
/useropts options def
|
12
|
-
/barcode exch def % We are given a barcode string
|
13
|
-
|
14
|
-
/includecheck false def % Enable/disable checkdigit
|
15
|
-
/includetext false def
|
16
|
-
/includecheckintext false def
|
17
|
-
/textfont /Courier def
|
18
|
-
/textsize 10 def
|
19
|
-
/textyoffset -7 def
|
20
|
-
/height 1 def
|
21
|
-
|
22
|
-
% Parse the input options
|
23
|
-
options {
|
24
|
-
token false eq {exit} if dup length string cvs (=) search
|
25
|
-
true eq {cvlit exch pop exch def} {cvlit true def} ifelse
|
26
|
-
} loop
|
27
|
-
|
28
|
-
/textfont textfont cvlit def
|
29
|
-
/textsize textsize cvr def
|
30
|
-
/textyoffset textyoffset cvr def
|
31
|
-
/height height cvr def
|
32
|
-
|
33
|
-
% Create an array containing the character mappings
|
34
|
-
/encs
|
35
|
-
[ (1113313111) (3113111131) (1133111131) (3133111111) (1113311131)
|
36
|
-
(3113311111) (1133311111) (1113113131) (3113113111) (1133113111)
|
37
|
-
(3111131131) (1131131131) (3131131111) (1111331131) (3111331111)
|
38
|
-
(1131331111) (1111133131) (3111133111) (1131133111) (1111333111)
|
39
|
-
(3111111331) (1131111331) (3131111311) (1111311331) (3111311311)
|
40
|
-
(1131311311) (1111113331) (3111113311) (1131113311) (1111313311)
|
41
|
-
(3311111131) (1331111131) (3331111111) (1311311131) (3311311111)
|
42
|
-
(1331311111) (1311113131) (3311113111) (1331113111) (1313131111)
|
43
|
-
(1313111311) (1311131311) (1113131311) (1311313111)
|
44
|
-
] def
|
45
|
-
|
46
|
-
% Create a string of the available characters
|
47
|
-
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*) def
|
48
|
-
|
49
|
-
/barlen barcode length def % Length of the code
|
50
|
-
|
51
|
-
includecheck {
|
52
|
-
/sbs barlen 10 mul 30 add string def
|
53
|
-
/txt barlen 3 add array def
|
54
|
-
} {
|
55
|
-
/sbs barlen 10 mul 20 add string def
|
56
|
-
/txt barlen 2 add array def
|
57
|
-
} ifelse
|
58
|
-
|
59
|
-
/checksum 0 def
|
60
|
-
|
61
|
-
% Put the start character
|
62
|
-
sbs 0 encs 43 get putinterval
|
63
|
-
txt 0 [(*) 0 textyoffset textfont textsize] put
|
64
|
-
|
65
|
-
0 1 barlen 1 sub {
|
66
|
-
/i exch def
|
67
|
-
% Lookup the encoding for the each barcode character
|
68
|
-
barcode i 1 getinterval barchars exch search
|
69
|
-
pop % Discard true leaving pre
|
70
|
-
length /indx exch def % indx is the length of pre
|
71
|
-
pop pop % Discard seek and post
|
72
|
-
/enc encs indx get def % Get the indxth encoding
|
73
|
-
sbs i 10 mul 10 add enc putinterval % Put encoded digit into sbs
|
74
|
-
txt i 1 add [barcode i 1 getinterval i 1 add 16 mul textyoffset textfont textsize] put
|
75
|
-
/checksum checksum indx add def
|
76
|
-
} for
|
77
|
-
|
78
|
-
% Put the checksum and end characters
|
79
|
-
includecheck {
|
80
|
-
/checksum checksum 43 mod def
|
81
|
-
sbs barlen 10 mul 10 add encs checksum get putinterval
|
82
|
-
includecheckintext {
|
83
|
-
txt barlen 1 add [barchars checksum 1 getinterval barlen 1 add 16 mul textyoffset textfont textsize] put
|
84
|
-
} {
|
85
|
-
txt barlen 1 add [() barlen 1 add 16 mul textyoffset textfont textsize] put
|
86
|
-
} ifelse
|
87
|
-
sbs barlen 10 mul 20 add encs 43 get putinterval
|
88
|
-
txt barlen 2 add [(*) barlen 2 add 16 mul textyoffset textfont textsize] put
|
89
|
-
} {
|
90
|
-
sbs barlen 10 mul 10 add encs 43 get putinterval
|
91
|
-
txt barlen 1 add [(*) barlen 1 add 16 mul textyoffset textfont textsize] put
|
92
|
-
} ifelse
|
93
|
-
|
94
|
-
% Return the arguments
|
95
|
-
/retval 8 dict def
|
96
|
-
retval (ren) (renlinear) put
|
97
|
-
retval (sbs) [sbs {48 sub} forall] put
|
98
|
-
retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
|
99
|
-
retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
|
100
|
-
includetext {
|
101
|
-
retval (txt) txt put
|
102
|
-
} if
|
103
|
-
retval (opt) useropts put
|
104
|
-
retval
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
} bind def
|
109
|
-
/code39 load 0 1 dict put
|