rghost_barcode 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/doc/classes/RGhost.html +109 -0
- data/lib/doc/classes/RGhost/Barcode.html +147 -0
- data/lib/doc/classes/RGhost/Barcode/Auspost.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Azteccode.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Base.html +266 -0
- data/lib/doc/classes/RGhost/Barcode/Base.src/M000004.html +34 -0
- data/lib/doc/classes/RGhost/Barcode/Base.src/M000005.html +30 -0
- data/lib/doc/classes/RGhost/Barcode/Base.src/M000006.html +20 -0
- data/lib/doc/classes/RGhost/Barcode/Border.html +170 -0
- data/lib/doc/classes/RGhost/Barcode/Border.src/M000001.html +27 -0
- data/lib/doc/classes/RGhost/Barcode/Code11.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Code128.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Code2of5.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Code39.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Code93.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Datamatrix.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Ean13.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Ean2.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Ean5.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Ean8.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Guard.html +174 -0
- data/lib/doc/classes/RGhost/Barcode/Guard.src/M000003.html +27 -0
- data/lib/doc/classes/RGhost/Barcode/Interleaved2of5.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Isbn.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Kix.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Maxicode.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Msi.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Onecode.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.html +262 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000007.html +20 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000008.html +18 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000009.html +18 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000010.html +18 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000011.html +18 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000012.html +24 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000013.html +18 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000014.html +18 -0
- data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000015.html +16 -0
- data/lib/doc/classes/RGhost/Barcode/Pdf417.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Pharmacode.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Plessey.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Postnet.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Qrcode.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Rationalizedcodabar.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Raw.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Royalmail.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Rss14.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Rssexpanded.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Rsslimited.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Symbol.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Text.html +193 -0
- data/lib/doc/classes/RGhost/Barcode/Text.src/M000002.html +30 -0
- data/lib/doc/classes/RGhost/Barcode/Upca.html +113 -0
- data/lib/doc/classes/RGhost/Barcode/Upce.html +113 -0
- data/lib/doc/classes/RGhost/Config.html +150 -0
- data/lib/doc/classes/RGhost/Config.src/M000016.html +45 -0
- data/lib/doc/classes/RGhost/Document.html +704 -0
- data/lib/doc/classes/RGhost/Document.src/M000017.html +19 -0
- data/lib/doc/classes/RGhost/Document.src/M000018.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000019.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000020.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000021.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000022.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000023.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000024.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000025.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000026.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000027.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000028.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000029.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000030.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000031.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000032.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000033.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000034.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000035.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000036.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000037.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000038.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000039.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000040.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000041.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000042.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000043.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000044.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000045.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000046.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000047.html +18 -0
- data/lib/doc/classes/RGhost/Document.src/M000048.html +18 -0
- data/lib/doc/created.rid +1 -0
- data/lib/doc/files/rghost_barcode/rghost_barcode_adapter_rb.html +101 -0
- data/lib/doc/files/rghost_barcode/rghost_barcode_base_rb.html +101 -0
- data/lib/doc/files/rghost_barcode/rghost_barcode_classes_rb.html +101 -0
- data/lib/doc/files/rghost_barcode/rghost_barcode_examples_rb.html +101 -0
- data/lib/doc/files/rghost_barcode/rghost_barcode_version_rb.html +101 -0
- data/lib/doc/files/rghost_barcode_rb.html +111 -0
- data/lib/doc/files/teste_main_rb.html +110 -0
- data/lib/doc/fr_class_index.html +67 -0
- data/lib/doc/fr_file_index.html +33 -0
- data/lib/doc/fr_method_index.html +74 -0
- data/lib/doc/index.html +24 -0
- data/lib/rghost_barcode.rb +7 -0
- data/lib/rghost_barcode/ps/auspost.ps +192 -0
- data/lib/rghost_barcode/ps/azteccode.ps +357 -0
- data/lib/rghost_barcode/ps/barcode_template.eps +1193 -0
- data/lib/rghost_barcode/ps/code11.ps +128 -0
- data/lib/rghost_barcode/ps/code128.ps +121 -0
- data/lib/rghost_barcode/ps/code2of5.ps +106 -0
- data/lib/rghost_barcode/ps/code39.ps +109 -0
- data/lib/rghost_barcode/ps/code93.ps +117 -0
- data/lib/rghost_barcode/ps/datamatrix.ps +328 -0
- data/lib/rghost_barcode/ps/ean13.ps +183 -0
- data/lib/rghost_barcode/ps/ean2.ps +101 -0
- data/lib/rghost_barcode/ps/ean5.ps +116 -0
- data/lib/rghost_barcode/ps/ean8.ps +101 -0
- data/lib/rghost_barcode/ps/interleaved2of5.ps +132 -0
- data/lib/rghost_barcode/ps/isbn.ps +118 -0
- data/lib/rghost_barcode/ps/kix.ps +98 -0
- data/lib/rghost_barcode/ps/maxicode.ps +307 -0
- data/lib/rghost_barcode/ps/msi.ps +104 -0
- data/lib/rghost_barcode/ps/onecode.ps +276 -0
- data/lib/rghost_barcode/ps/pdf417.ps +428 -0
- data/lib/rghost_barcode/ps/pharmacode.ps +69 -0
- data/lib/rghost_barcode/ps/plessey.ps +121 -0
- data/lib/rghost_barcode/ps/postnet.ps +114 -0
- data/lib/rghost_barcode/ps/qrcode.ps +530 -0
- data/lib/rghost_barcode/ps/rationalizedcodabar.ps +117 -0
- data/lib/rghost_barcode/ps/raw.ps +35 -0
- data/lib/rghost_barcode/ps/render.ps +307 -0
- data/lib/rghost_barcode/ps/render.ps~ +308 -0
- data/lib/rghost_barcode/ps/royalmail.ps +119 -0
- data/lib/rghost_barcode/ps/rss14.ps +237 -0
- data/lib/rghost_barcode/ps/rssexpanded.ps +211 -0
- data/lib/rghost_barcode/ps/rsslimited.ps +191 -0
- data/lib/rghost_barcode/ps/symbol.ps +49 -0
- data/lib/rghost_barcode/ps/upca.ps +128 -0
- data/lib/rghost_barcode/ps/upce.ps +157 -0
- data/lib/rghost_barcode/rghost_barcode_adapter.rb +249 -0
- data/lib/rghost_barcode/rghost_barcode_base.rb +210 -0
- data/lib/rghost_barcode/rghost_barcode_classes.rb +96 -0
- data/lib/rghost_barcode/rghost_barcode_examples.rb +35 -0
- data/lib/rghost_barcode/rghost_barcode_version.rb +8 -0
- data/lib/teste_main.rb +94 -0
- metadata +218 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
% --DESC: UPC-A
|
3
|
+
% --EXAM: 78858101497
|
4
|
+
% --EXOP: includetext
|
5
|
+
% --RNDR: renlinear
|
6
|
+
/upca {
|
7
|
+
|
8
|
+
0 begin
|
9
|
+
|
10
|
+
/options exch def
|
11
|
+
/useropts options def
|
12
|
+
/barcode exch def % We are given a barcode string
|
13
|
+
|
14
|
+
/includetext false def % Enable/disable text
|
15
|
+
/textfont /Helvetica def
|
16
|
+
/textsize 12 def
|
17
|
+
/textyoffset -4 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
|
+
/barlen barcode length def % Length of the code
|
32
|
+
|
33
|
+
% Add checksum digit to barcode if length is odd
|
34
|
+
barlen 2 mod 0 ne {
|
35
|
+
/pad barlen 1 add string def % Create pad one bigger than barcode
|
36
|
+
/checksum 0 def
|
37
|
+
0 1 barlen 1 sub {
|
38
|
+
/i exch def
|
39
|
+
/barchar barcode i get 48 sub def
|
40
|
+
i 2 mod 0 ne {
|
41
|
+
/checksum checksum barchar add def
|
42
|
+
} {
|
43
|
+
/checksum checksum barchar 3 mul add def
|
44
|
+
} ifelse
|
45
|
+
} for
|
46
|
+
/checksum 10 checksum 10 mod sub 10 mod def
|
47
|
+
pad 0 barcode putinterval % Add barcode to the start of the pad
|
48
|
+
pad barlen checksum 48 add put % Put ascii for checksum at end of pad
|
49
|
+
/barcode pad def % barcode=pad
|
50
|
+
/barlen barlen 1 add def % barlen++
|
51
|
+
} if
|
52
|
+
|
53
|
+
% Create an array containing the character mappings
|
54
|
+
/encs
|
55
|
+
[ (3211) (2221) (2122) (1411) (1132)
|
56
|
+
(1231) (1114) (1312) (1213) (3112)
|
57
|
+
(111) (11111) (111)
|
58
|
+
] def
|
59
|
+
|
60
|
+
% Create a string of the available characters
|
61
|
+
/barchars (0123456789) def
|
62
|
+
|
63
|
+
/sbs barlen 4 mul 11 add string def
|
64
|
+
/txt barlen array def
|
65
|
+
|
66
|
+
% Put the start character
|
67
|
+
sbs 0 encs 10 get putinterval
|
68
|
+
|
69
|
+
% Left side
|
70
|
+
0 1 5 {
|
71
|
+
% Lookup the encoding for the each barcode character
|
72
|
+
/i exch def
|
73
|
+
barcode i 1 getinterval barchars exch search
|
74
|
+
pop % Discard true leaving pre
|
75
|
+
length /indx exch def % indx is the length of pre
|
76
|
+
pop pop % Discard seek and post
|
77
|
+
/enc encs indx get def % Get the indxth encoding
|
78
|
+
sbs i 4 mul 3 add enc putinterval % Put encoded digit into sbs
|
79
|
+
i 0 eq { % First digit is before the guard bars
|
80
|
+
txt 0 [barcode 0 1 getinterval -7 textyoffset textfont textsize 2 sub] put
|
81
|
+
} {
|
82
|
+
txt i [barcode i 1 getinterval i 7 mul 4 add textyoffset textfont textsize] put
|
83
|
+
} ifelse
|
84
|
+
} for
|
85
|
+
|
86
|
+
% Put the middle character
|
87
|
+
sbs 6 4 mul 3 add encs 11 get putinterval
|
88
|
+
|
89
|
+
% Right side
|
90
|
+
6 1 11 {
|
91
|
+
% Lookup the encoding for the each barcode character
|
92
|
+
/i exch def
|
93
|
+
barcode i 1 getinterval barchars exch search
|
94
|
+
pop % Discard true leaving pre
|
95
|
+
length /indx exch def % indx is the length of pre
|
96
|
+
pop pop % Discard seek and post
|
97
|
+
/enc encs indx get def % Get the indxth encoding
|
98
|
+
sbs i 4 mul 8 add enc putinterval % Put encoded digit into sbs
|
99
|
+
i 11 eq { % Last digit is after guard bars
|
100
|
+
txt 11 [barcode 11 1 getinterval 96 textyoffset textfont textsize 2 sub] put
|
101
|
+
} {
|
102
|
+
txt i [barcode i 1 getinterval i 7 mul 8 add textyoffset textfont textsize] put
|
103
|
+
} ifelse
|
104
|
+
} for
|
105
|
+
|
106
|
+
% Put the end character
|
107
|
+
sbs barlen 4 mul 8 add encs 12 get putinterval
|
108
|
+
|
109
|
+
% Return the arguments
|
110
|
+
/retval 8 dict def
|
111
|
+
retval (ren) (renlinear) put
|
112
|
+
retval (sbs) [sbs {48 sub} forall] put
|
113
|
+
includetext {
|
114
|
+
retval (bhs) [4{height}repeat 10{height .075 sub}repeat height height 10{height .075 sub}repeat 5{height}repeat] put
|
115
|
+
retval (bbs) [0 0 0 0 10{.075}repeat 0 0 10{.075}repeat 0 0 0 0 0] put
|
116
|
+
retval (txt) txt put
|
117
|
+
} {
|
118
|
+
retval (bhs) [31{height}repeat] put
|
119
|
+
retval (bbs) [31{0}repeat] put
|
120
|
+
} ifelse
|
121
|
+
retval (opt) useropts put
|
122
|
+
retval (borderbottom) 5 put
|
123
|
+
retval
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
} bind def
|
128
|
+
/upca load 0 1 dict put
|
@@ -0,0 +1,157 @@
|
|
1
|
+
|
2
|
+
% --DESC: UPC-E
|
3
|
+
% --EXAM: 0123456
|
4
|
+
% --EXOP: includetext height=0.4
|
5
|
+
% --RNDR: renlinear
|
6
|
+
/upce {
|
7
|
+
|
8
|
+
0 begin
|
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 /Helvetica def
|
16
|
+
/textsize 12 def
|
17
|
+
/textyoffset -4 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
|
+
/barlen barcode length def % Length of the code
|
32
|
+
|
33
|
+
% Create an array containing the character mappings
|
34
|
+
/encs
|
35
|
+
[ (3211) (2221) (2122) (1411) (1132)
|
36
|
+
(1231) (1114) (1312) (1213) (3112)
|
37
|
+
(111) (1111111)
|
38
|
+
] def
|
39
|
+
|
40
|
+
% Create a string of the available characters
|
41
|
+
/barchars (0123456789) def
|
42
|
+
|
43
|
+
/mirrormaps
|
44
|
+
[ (000111) (001011) (001101) (001110) (010011)
|
45
|
+
(011001) (011100) (010101) (010110) (011010)
|
46
|
+
] def
|
47
|
+
|
48
|
+
% Add checksum digit to barcode if length is odd
|
49
|
+
barlen 2 mod 0 ne {
|
50
|
+
% Derive the equivalent UPC-A for its checksum
|
51
|
+
/upcacode (00000000000) 11 string copy def
|
52
|
+
barcode 6 get 48 sub 2 le {
|
53
|
+
upcacode 1 barcode 1 2 getinterval putinterval
|
54
|
+
upcacode 3 barcode 6 1 getinterval putinterval
|
55
|
+
upcacode 8 barcode 3 3 getinterval putinterval
|
56
|
+
} if
|
57
|
+
barcode 6 get 48 sub 3 eq {
|
58
|
+
upcacode 1 barcode 1 3 getinterval putinterval
|
59
|
+
upcacode 9 barcode 4 2 getinterval putinterval
|
60
|
+
} if
|
61
|
+
barcode 6 get 48 sub 4 eq {
|
62
|
+
upcacode 1 barcode 1 4 getinterval putinterval
|
63
|
+
upcacode 10 barcode 5 1 getinterval putinterval
|
64
|
+
} if
|
65
|
+
barcode 6 get 48 sub 5 ge {
|
66
|
+
upcacode 1 barcode 1 5 getinterval putinterval
|
67
|
+
upcacode 10 barcode 6 1 getinterval putinterval
|
68
|
+
} if
|
69
|
+
/checksum 0 def
|
70
|
+
0 1 10 {
|
71
|
+
/i exch def
|
72
|
+
/barchar upcacode i get 48 sub def
|
73
|
+
i 2 mod 0 ne {
|
74
|
+
/checksum checksum barchar add def
|
75
|
+
} {
|
76
|
+
/checksum checksum barchar 3 mul add def
|
77
|
+
} ifelse
|
78
|
+
} for
|
79
|
+
/checksum 10 checksum 10 mod sub 10 mod def
|
80
|
+
/pad barlen 1 add string def % Create pad one bigger than barcode
|
81
|
+
pad 0 barcode putinterval % Add barcode to the start of the pad
|
82
|
+
pad barlen checksum 48 add put % Put ascii for checksum at end of pad
|
83
|
+
/barcode pad def % barcode=pad
|
84
|
+
/barlen barlen 1 add def % barlen++
|
85
|
+
} if
|
86
|
+
/txt barlen array def
|
87
|
+
txt 0 [barcode 0 1 getinterval -7 textyoffset textfont textsize 2 sub] put
|
88
|
+
|
89
|
+
% Determine the mirror map based on checksum
|
90
|
+
/mirrormap mirrormaps barcode barlen 1 sub get 48 sub get def
|
91
|
+
|
92
|
+
% Invert the mirrormap if we are using a non-zero number system
|
93
|
+
barcode 0 get 48 eq {
|
94
|
+
/invt mirrormap length string def
|
95
|
+
0 1 mirrormap length 1 sub {
|
96
|
+
/i exch def
|
97
|
+
mirrormap i get 48 eq {
|
98
|
+
invt i 49 put
|
99
|
+
} {
|
100
|
+
invt i 48 put
|
101
|
+
} ifelse
|
102
|
+
} for
|
103
|
+
/mirrormap invt def
|
104
|
+
} if
|
105
|
+
|
106
|
+
/sbs barlen 2 sub 4 mul 10 add string def
|
107
|
+
|
108
|
+
% Put the start character
|
109
|
+
sbs 0 encs 10 get putinterval
|
110
|
+
|
111
|
+
1 1 6 {
|
112
|
+
/i exch def
|
113
|
+
% Lookup the encoding for the each barcode character
|
114
|
+
barcode i 1 getinterval barchars exch search
|
115
|
+
pop % Discard true leaving pre
|
116
|
+
length /indx exch def % indx is the length of pre
|
117
|
+
pop pop % Discard seek and post
|
118
|
+
/enc encs indx get def % Get the indxth encoding
|
119
|
+
mirrormap i 1 sub get 49 eq { % Reverse enc if 1 in this position in mirrormap
|
120
|
+
/enclen enc length def
|
121
|
+
/revenc enclen string def
|
122
|
+
0 1 enclen 1 sub {
|
123
|
+
/j exch def
|
124
|
+
/char enc j get def
|
125
|
+
revenc enclen j sub 1 sub char put
|
126
|
+
} for
|
127
|
+
/enc revenc def
|
128
|
+
} if
|
129
|
+
sbs i 1 sub 4 mul 3 add enc putinterval % Put encoded digit into sbs
|
130
|
+
txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textyoffset textfont textsize] put
|
131
|
+
} for
|
132
|
+
|
133
|
+
txt 7 [barcode 7 1 getinterval 6 7 mul 11 add textyoffset textfont textsize 2 sub] put
|
134
|
+
|
135
|
+
% Put the end character
|
136
|
+
sbs barlen 2 sub 4 mul 3 add encs 11 get putinterval
|
137
|
+
|
138
|
+
% Return the arguments
|
139
|
+
/retval 8 dict def
|
140
|
+
retval (ren) (renlinear) put
|
141
|
+
retval (sbs) [sbs {48 sub} forall] put
|
142
|
+
includetext {
|
143
|
+
retval (bhs) [height height 12{height .075 sub}repeat height height height] put
|
144
|
+
retval (bbs) [0 0 12{.075}repeat 0 0 0] put
|
145
|
+
retval (txt) txt put
|
146
|
+
} {
|
147
|
+
retval (bhs) [17{height}repeat] put
|
148
|
+
retval (bbs) [17{0}repeat] put
|
149
|
+
} ifelse
|
150
|
+
retval (opt) useropts put
|
151
|
+
retval (borderbottom) 5 put
|
152
|
+
retval
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
} bind def
|
157
|
+
/upce load 0 1 dict put
|
@@ -0,0 +1,249 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
RGhost::Config::GS[:extensions] << File.join(File.dirname(__FILE__),'ps')
|
4
|
+
RGhost::Config::GS[:preload] << :render
|
5
|
+
|
6
|
+
class RGhost::Document
|
7
|
+
|
8
|
+
#Facade for RGhost::Barcode::Isbn
|
9
|
+
def barcode_isbn(barcode_string,options={})
|
10
|
+
set RGhost::Load.library(:ean13)
|
11
|
+
set RGhost::Barcode::Isbn.new(barcode_string,options)
|
12
|
+
end
|
13
|
+
|
14
|
+
#Facade for RGhost::Barcode::Code11
|
15
|
+
def barcode_code11(barcode_string,options={})
|
16
|
+
set RGhost::Barcode::Code11.new(barcode_string,options)
|
17
|
+
end
|
18
|
+
|
19
|
+
#Facade for RGhost::Barcode::Code2of5
|
20
|
+
def barcode_code2of5(barcode_string,options={})
|
21
|
+
set RGhost::Barcode::Code2of5.new(barcode_string,options)
|
22
|
+
end
|
23
|
+
|
24
|
+
#Facade for RGhost::Barcode::Ean8
|
25
|
+
def barcode_ean8(barcode_string,options={})
|
26
|
+
set RGhost::Barcode::Ean8.new(barcode_string,options)
|
27
|
+
end
|
28
|
+
|
29
|
+
#Facade for RGhost::Barcode::Postnet
|
30
|
+
def barcode_postnet(barcode_string,options={})
|
31
|
+
set RGhost::Barcode::Postnet.new(barcode_string,options)
|
32
|
+
end
|
33
|
+
|
34
|
+
#Facade for RGhost::Barcode::Rssexpanded
|
35
|
+
def barcode_rssexpanded(barcode_string,options={})
|
36
|
+
set RGhost::Barcode::Rssexpanded.new(barcode_string,options)
|
37
|
+
end
|
38
|
+
|
39
|
+
#Facade for RGhost::Barcode::Auspost
|
40
|
+
def barcode_auspost(barcode_string,options={})
|
41
|
+
set RGhost::Barcode::Auspost.new(barcode_string,options)
|
42
|
+
end
|
43
|
+
|
44
|
+
#Facade for RGhost::Barcode::Code39
|
45
|
+
def barcode_code39(barcode_string,options={})
|
46
|
+
set RGhost::Barcode::Code39.new(barcode_string,options)
|
47
|
+
end
|
48
|
+
|
49
|
+
#Facade for RGhost::Barcode::Upce
|
50
|
+
def barcode_upce(barcode_string,options={})
|
51
|
+
set RGhost::Barcode::Upce.new(barcode_string,options)
|
52
|
+
end
|
53
|
+
|
54
|
+
#Facade for RGhost::Barcode::Azteccode
|
55
|
+
def barcode_azteccode(barcode_string,options={})
|
56
|
+
set RGhost::Barcode::Azteccode.new(barcode_string,options)
|
57
|
+
end
|
58
|
+
|
59
|
+
#Facade for RGhost::Barcode::Ean5
|
60
|
+
def barcode_ean5(barcode_string,options={})
|
61
|
+
set RGhost::Barcode::Ean5.new(barcode_string,options)
|
62
|
+
end
|
63
|
+
|
64
|
+
#Facade for RGhost::Barcode::Plessey
|
65
|
+
def barcode_plessey(barcode_string,options={})
|
66
|
+
set RGhost::Barcode::Plessey.new(barcode_string,options)
|
67
|
+
end
|
68
|
+
|
69
|
+
#Facade for RGhost::Barcode::Raw
|
70
|
+
def barcode_raw(barcode_string,options={})
|
71
|
+
set RGhost::Barcode::Raw.new(barcode_string,options)
|
72
|
+
end
|
73
|
+
|
74
|
+
#Facade for RGhost::Barcode::Rss14
|
75
|
+
def barcode_rss14(barcode_string,options={})
|
76
|
+
set RGhost::Barcode::Rss14.new(barcode_string,options)
|
77
|
+
end
|
78
|
+
|
79
|
+
#Facade for RGhost::Barcode::Royalmail
|
80
|
+
def barcode_royalmail(barcode_string,options={})
|
81
|
+
set RGhost::Barcode::Royalmail.new(barcode_string,options)
|
82
|
+
end
|
83
|
+
|
84
|
+
#Facade for RGhost::Barcode::Datamatrix
|
85
|
+
def barcode_datamatrix(barcode_string,options={})
|
86
|
+
set RGhost::Barcode::Datamatrix.new(barcode_string,options)
|
87
|
+
end
|
88
|
+
|
89
|
+
#Facade for RGhost::Barcode::Code128
|
90
|
+
def barcode_code128(barcode_string,options={})
|
91
|
+
set RGhost::Barcode::Code128.new(barcode_string,options)
|
92
|
+
end
|
93
|
+
|
94
|
+
#Facade for RGhost::Barcode::Upca
|
95
|
+
def barcode_upca(barcode_string,options={})
|
96
|
+
set RGhost::Barcode::Upca.new(barcode_string,options)
|
97
|
+
end
|
98
|
+
|
99
|
+
#Facade for RGhost::Barcode::Qrcode
|
100
|
+
def barcode_qrcode(barcode_string,options={})
|
101
|
+
set RGhost::Barcode::Qrcode.new(barcode_string,options)
|
102
|
+
end
|
103
|
+
|
104
|
+
#Facade for RGhost::Barcode::Maxicode
|
105
|
+
def barcode_maxicode(barcode_string,options={})
|
106
|
+
set RGhost::Barcode::Maxicode.new(barcode_string,options)
|
107
|
+
end
|
108
|
+
|
109
|
+
#Facade for RGhost::Barcode::Rationalizedcodabar
|
110
|
+
def barcode_rationalizedcodabar(barcode_string,options={})
|
111
|
+
set RGhost::Barcode::Rationalizedcodabar.new(barcode_string,options)
|
112
|
+
end
|
113
|
+
|
114
|
+
#Facade for RGhost::Barcode::Code93
|
115
|
+
def barcode_code93(barcode_string,options={})
|
116
|
+
set RGhost::Barcode::Code93.new(barcode_string,options)
|
117
|
+
end
|
118
|
+
|
119
|
+
#Facade for RGhost::Barcode::Msi
|
120
|
+
def barcode_msi(barcode_string,options={})
|
121
|
+
set RGhost::Barcode::Msi.new(barcode_string,options)
|
122
|
+
end
|
123
|
+
|
124
|
+
#Facade for RGhost::Barcode::Rsslimited
|
125
|
+
def barcode_rsslimited(barcode_string,options={})
|
126
|
+
set RGhost::Barcode::Rsslimited.new(barcode_string,options)
|
127
|
+
end
|
128
|
+
|
129
|
+
#Facade for RGhost::Barcode::Ean13
|
130
|
+
def barcode_ean13(barcode_string,options={})
|
131
|
+
set RGhost::Barcode::Ean13.new(barcode_string,options)
|
132
|
+
end
|
133
|
+
|
134
|
+
#Facade for RGhost::Barcode::Onecode
|
135
|
+
def barcode_onecode(barcode_string,options={})
|
136
|
+
set RGhost::Barcode::Onecode.new(barcode_string,options)
|
137
|
+
end
|
138
|
+
|
139
|
+
#Facade for RGhost::Barcode::Ean2
|
140
|
+
def barcode_ean2(barcode_string,options={})
|
141
|
+
set RGhost::Barcode::Ean2.new(barcode_string,options)
|
142
|
+
end
|
143
|
+
|
144
|
+
#Facade for RGhost::Barcode::Interleaved2of5
|
145
|
+
def barcode_interleaved2of5(barcode_string,options={})
|
146
|
+
set RGhost::Barcode::Interleaved2of5.new(barcode_string,options)
|
147
|
+
end
|
148
|
+
|
149
|
+
#Facade for RGhost::Barcode::Symbol
|
150
|
+
def barcode_symbol(barcode_string,options={})
|
151
|
+
set RGhost::Barcode::Symbol.new(barcode_string,options)
|
152
|
+
end
|
153
|
+
|
154
|
+
#Facade for RGhost::Barcode::Pdf417
|
155
|
+
def barcode_pdf417(barcode_string,options={})
|
156
|
+
set RGhost::Barcode::Pdf417.new(barcode_string,options)
|
157
|
+
end
|
158
|
+
|
159
|
+
#Facade for RGhost::Barcode::Kix
|
160
|
+
def barcode_kix(barcode_string,options={})
|
161
|
+
set RGhost::Barcode::Kix.new(barcode_string,options)
|
162
|
+
end
|
163
|
+
|
164
|
+
#Facade for RGhost::Barcode::Pharmacode
|
165
|
+
def barcode_pharmacode(barcode_string,options={})
|
166
|
+
set RGhost::Barcode::Pharmacode.new(barcode_string,options)
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
module RGhost::Config
|
173
|
+
BARCODE_EXAMPLES={
|
174
|
+
'plessey' => ['01234ABCD',{ :text => {:size => 10}}],
|
175
|
+
'isbn' => ['978-1-56592-479',{:text => {:size => 10}, :guard=>{:whitespace => true }}],
|
176
|
+
'rsslimited' => ['00978186074271',{:height => 1 , :text => {:size => 10}}],
|
177
|
+
'pdf417' => ['^453^178^121^239',{:text => {:size => 10}, :columns => 2, :rows=> 10}],
|
178
|
+
'royalmail' => ['LE28HS9Z',{:text => {:size => 10}}],
|
179
|
+
'ean13' => ['977147396801',{ :guard=>{:whitespace => true }}],
|
180
|
+
'code11' => ['0123456789',{:text => {:size => 10}}],
|
181
|
+
'symbol' => ['fima',{:text => {:size => 10}}],
|
182
|
+
'qrcode' => ['000100000010000000001100010101100110000110000',{:text => {:size => 10}}],
|
183
|
+
'msi' => ['0123456789',{:text => {:size => 10}}],
|
184
|
+
'upca' => ['78858101497',{:text => {:size => 10}}],
|
185
|
+
'pharmacode' => ['117480',{:text => {:size => 10}}],
|
186
|
+
'kix' => ['1231FZ13XHS',{:text => {:size => 10}}],
|
187
|
+
'datamatrix' => ['^142^164^186',{:columns => 32, :rows=> 32}],
|
188
|
+
'rssexpanded' => ['000000010011001010100001000000010000',{:text => {:size => 10}}],
|
189
|
+
'ean2' => ['05',{:text => {:size => 10}}],
|
190
|
+
'rationalizedcodabar' => ['A0123456789B',{:text => {:size => 10}}],
|
191
|
+
'upce' => ['0123456',{:text => {:size => 10}}],
|
192
|
+
'ean5' => ['90200',{:text => {:size => 10}}],
|
193
|
+
'code2of5' => ['01234567',{:text => {:size => 10}}],
|
194
|
+
'code93' => ['THIS IS CODE 93',{:text => {:size => 10}}],
|
195
|
+
'postnet' => ['012345',{:text => {:size => 10}}],
|
196
|
+
'maxicode' => ['^059^042^041^059^040^03001^02996152382802^029840^029001^0291Z00004951^029UPSN^02906X610^029159^0291234567^0291^0471^029^029Y^029634 ALPHA DR^029PITTSBURGH^029PA^030^062^004^063', {:mode=> 2, :text => {:size => 10}}],
|
197
|
+
'raw' => ['331132131313411122131311333213114131131221323',{:text => {:size => 10}}],
|
198
|
+
'onecode' => ['0123456709498765432101234567891',{:text => {:size => 10}}],
|
199
|
+
'code39' => ['THIS IS CODE 39',{:text => {:size => 10}}],
|
200
|
+
'auspost' => ['5956439111ABA 9',{:text => {:size => 10}}],
|
201
|
+
'azteccode' => ['00100111001000000101001101111000010100111100101000000110',{:text => {:size => 10}, :format=> :compact}],
|
202
|
+
'ean8' => ['01335583',{:text => {:size => 10}}],
|
203
|
+
'interleaved2of5' => ['24012345678905',{
|
204
|
+
:text => {:size => 10, :offset => [0,-10], :enable => [:text, :check, :checkintext] },
|
205
|
+
:border => {:width => 4, :left => 15, :right => 15, :show => true},
|
206
|
+
:height => 2
|
207
|
+
}],
|
208
|
+
'code128' => ['^104^102Count^0990123456789^101!',{:text => {:size => 10}}],
|
209
|
+
'rss14' => ['24012345678905',{:text => {:size => 10}}]
|
210
|
+
|
211
|
+
|
212
|
+
}
|
213
|
+
#Generates catalog of barcodes.
|
214
|
+
#
|
215
|
+
# RGhost::Config.barcode_examples.render :pdf, :filename => "/tmp/barcode_catalog.pdf"
|
216
|
+
#
|
217
|
+
def self.barcode_examples() #(options={:text => {:size => 10}})
|
218
|
+
d=RGhost::Document.new :paper => [15,8], :margin_left => 2
|
219
|
+
#d.set RGhost::Barcode::Code39.new("ASDHAJSDF", :x => 1, :y => 5, :color => 'FF0000', :border =>{:color => '00FF00'}, :text =>{:size => 10, :color => '553297' }, :height => 1, :width => 4.545)
|
220
|
+
#d.barcode_isbn("978-1-56592-479", :x => 1, :y => 5, :color => 'FF0000', :border =>{:color => '00FF00'}, :text =>{:size => 10, :color => '553297' }, :height => 1, :width => 4.545)
|
221
|
+
#d.barcode_isbn("978-1-56592-479", :x => 1, :y => 10, :text =>{:size => 10})
|
222
|
+
d.define_template :barcode_template, File.join(File.dirname(__FILE__),'ps',"barcode_template.eps")
|
223
|
+
d.before_page_create do
|
224
|
+
use_template :barcode_template
|
225
|
+
end
|
226
|
+
RGhost::Config::BARCODE_EXAMPLES.each do |k,v|
|
227
|
+
|
228
|
+
d.show "Barcode Name: #{k}"
|
229
|
+
d.jump_rows 6
|
230
|
+
#opt=v[1][:text][:size]=10
|
231
|
+
opt=v[1]
|
232
|
+
d.send "barcode_#{k}".to_sym,v[0],opt.dup
|
233
|
+
d.jump_rows 2
|
234
|
+
d.show "Code String: #{v[0]}"
|
235
|
+
d.next_row
|
236
|
+
d.text("Options: #{opt.inspect}",false)
|
237
|
+
d.next_page
|
238
|
+
end
|
239
|
+
license=%Q{<big>Barcode Writer License</big><br/>Anybody is free to use and develop this code as they see fit, under the terms of the permissive MIT/X-Consortium license(http://postscriptbarcode.googlecode.com/svn/trunk/LICENSE), which requires that developers attribute any derivative code to this project in both the source code and documentation. As such I take no liability for its use or misuse.<br/><br/>Thanks a lot Terry!<br/> <i>Shairon Toledo</i> }
|
240
|
+
d.text license
|
241
|
+
d.next_row
|
242
|
+
d.show "RGhost::VERSION #{RGhost::VERSION::STRING}" , :align => :page_right, :tag => :b
|
243
|
+
d.next_row
|
244
|
+
d.show "RGhost::Barcode::VERSION #{RGhost::Barcode::VERSION::STRING}" , :align => :page_right, :tag => :b
|
245
|
+
d
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|