rghost_barcode 0.8 → 0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. data/lib/rghost_barcode.rb +7 -5
  2. data/lib/rghost_barcode/ps/barcode_base.ps +17090 -0
  3. data/lib/rghost_barcode/rghost_barcode_adapter.rb +22 -226
  4. data/lib/rghost_barcode/rghost_barcode_base.rb +12 -14
  5. data/lib/rghost_barcode/rghost_barcode_types.rb +86 -0
  6. data/lib/rghost_barcode/rghost_barcode_version.rb +2 -2
  7. metadata +30 -177
  8. data/lib/doc/classes/RGhost.html +0 -109
  9. data/lib/doc/classes/RGhost/Barcode.html +0 -147
  10. data/lib/doc/classes/RGhost/Barcode/Auspost.html +0 -113
  11. data/lib/doc/classes/RGhost/Barcode/Azteccode.html +0 -113
  12. data/lib/doc/classes/RGhost/Barcode/Base.html +0 -266
  13. data/lib/doc/classes/RGhost/Barcode/Base.src/M000004.html +0 -34
  14. data/lib/doc/classes/RGhost/Barcode/Base.src/M000005.html +0 -30
  15. data/lib/doc/classes/RGhost/Barcode/Base.src/M000006.html +0 -20
  16. data/lib/doc/classes/RGhost/Barcode/Border.html +0 -170
  17. data/lib/doc/classes/RGhost/Barcode/Border.src/M000001.html +0 -27
  18. data/lib/doc/classes/RGhost/Barcode/Code11.html +0 -113
  19. data/lib/doc/classes/RGhost/Barcode/Code128.html +0 -113
  20. data/lib/doc/classes/RGhost/Barcode/Code2of5.html +0 -113
  21. data/lib/doc/classes/RGhost/Barcode/Code39.html +0 -113
  22. data/lib/doc/classes/RGhost/Barcode/Code93.html +0 -113
  23. data/lib/doc/classes/RGhost/Barcode/Datamatrix.html +0 -113
  24. data/lib/doc/classes/RGhost/Barcode/Ean13.html +0 -113
  25. data/lib/doc/classes/RGhost/Barcode/Ean2.html +0 -113
  26. data/lib/doc/classes/RGhost/Barcode/Ean5.html +0 -113
  27. data/lib/doc/classes/RGhost/Barcode/Ean8.html +0 -113
  28. data/lib/doc/classes/RGhost/Barcode/Guard.html +0 -174
  29. data/lib/doc/classes/RGhost/Barcode/Guard.src/M000003.html +0 -27
  30. data/lib/doc/classes/RGhost/Barcode/Interleaved2of5.html +0 -113
  31. data/lib/doc/classes/RGhost/Barcode/Isbn.html +0 -113
  32. data/lib/doc/classes/RGhost/Barcode/Kix.html +0 -113
  33. data/lib/doc/classes/RGhost/Barcode/Maxicode.html +0 -113
  34. data/lib/doc/classes/RGhost/Barcode/Msi.html +0 -113
  35. data/lib/doc/classes/RGhost/Barcode/Onecode.html +0 -113
  36. data/lib/doc/classes/RGhost/Barcode/Parameter.html +0 -262
  37. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000007.html +0 -20
  38. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000008.html +0 -18
  39. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000009.html +0 -18
  40. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000010.html +0 -18
  41. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000011.html +0 -18
  42. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000012.html +0 -24
  43. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000013.html +0 -18
  44. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000014.html +0 -18
  45. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000015.html +0 -16
  46. data/lib/doc/classes/RGhost/Barcode/Pdf417.html +0 -113
  47. data/lib/doc/classes/RGhost/Barcode/Pharmacode.html +0 -113
  48. data/lib/doc/classes/RGhost/Barcode/Plessey.html +0 -113
  49. data/lib/doc/classes/RGhost/Barcode/Postnet.html +0 -113
  50. data/lib/doc/classes/RGhost/Barcode/Qrcode.html +0 -113
  51. data/lib/doc/classes/RGhost/Barcode/Rationalizedcodabar.html +0 -113
  52. data/lib/doc/classes/RGhost/Barcode/Raw.html +0 -113
  53. data/lib/doc/classes/RGhost/Barcode/Royalmail.html +0 -113
  54. data/lib/doc/classes/RGhost/Barcode/Rss14.html +0 -113
  55. data/lib/doc/classes/RGhost/Barcode/Rssexpanded.html +0 -113
  56. data/lib/doc/classes/RGhost/Barcode/Rsslimited.html +0 -113
  57. data/lib/doc/classes/RGhost/Barcode/Symbol.html +0 -113
  58. data/lib/doc/classes/RGhost/Barcode/Text.html +0 -193
  59. data/lib/doc/classes/RGhost/Barcode/Text.src/M000002.html +0 -30
  60. data/lib/doc/classes/RGhost/Barcode/Upca.html +0 -113
  61. data/lib/doc/classes/RGhost/Barcode/Upce.html +0 -113
  62. data/lib/doc/classes/RGhost/Config.html +0 -150
  63. data/lib/doc/classes/RGhost/Config.src/M000016.html +0 -45
  64. data/lib/doc/classes/RGhost/Document.html +0 -704
  65. data/lib/doc/classes/RGhost/Document.src/M000017.html +0 -19
  66. data/lib/doc/classes/RGhost/Document.src/M000018.html +0 -18
  67. data/lib/doc/classes/RGhost/Document.src/M000019.html +0 -18
  68. data/lib/doc/classes/RGhost/Document.src/M000020.html +0 -18
  69. data/lib/doc/classes/RGhost/Document.src/M000021.html +0 -18
  70. data/lib/doc/classes/RGhost/Document.src/M000022.html +0 -18
  71. data/lib/doc/classes/RGhost/Document.src/M000023.html +0 -18
  72. data/lib/doc/classes/RGhost/Document.src/M000024.html +0 -18
  73. data/lib/doc/classes/RGhost/Document.src/M000025.html +0 -18
  74. data/lib/doc/classes/RGhost/Document.src/M000026.html +0 -18
  75. data/lib/doc/classes/RGhost/Document.src/M000027.html +0 -18
  76. data/lib/doc/classes/RGhost/Document.src/M000028.html +0 -18
  77. data/lib/doc/classes/RGhost/Document.src/M000029.html +0 -18
  78. data/lib/doc/classes/RGhost/Document.src/M000030.html +0 -18
  79. data/lib/doc/classes/RGhost/Document.src/M000031.html +0 -18
  80. data/lib/doc/classes/RGhost/Document.src/M000032.html +0 -18
  81. data/lib/doc/classes/RGhost/Document.src/M000033.html +0 -18
  82. data/lib/doc/classes/RGhost/Document.src/M000034.html +0 -18
  83. data/lib/doc/classes/RGhost/Document.src/M000035.html +0 -18
  84. data/lib/doc/classes/RGhost/Document.src/M000036.html +0 -18
  85. data/lib/doc/classes/RGhost/Document.src/M000037.html +0 -18
  86. data/lib/doc/classes/RGhost/Document.src/M000038.html +0 -18
  87. data/lib/doc/classes/RGhost/Document.src/M000039.html +0 -18
  88. data/lib/doc/classes/RGhost/Document.src/M000040.html +0 -18
  89. data/lib/doc/classes/RGhost/Document.src/M000041.html +0 -18
  90. data/lib/doc/classes/RGhost/Document.src/M000042.html +0 -18
  91. data/lib/doc/classes/RGhost/Document.src/M000043.html +0 -18
  92. data/lib/doc/classes/RGhost/Document.src/M000044.html +0 -18
  93. data/lib/doc/classes/RGhost/Document.src/M000045.html +0 -18
  94. data/lib/doc/classes/RGhost/Document.src/M000046.html +0 -18
  95. data/lib/doc/classes/RGhost/Document.src/M000047.html +0 -18
  96. data/lib/doc/classes/RGhost/Document.src/M000048.html +0 -18
  97. data/lib/doc/created.rid +0 -1
  98. data/lib/doc/files/rghost_barcode/rghost_barcode_adapter_rb.html +0 -101
  99. data/lib/doc/files/rghost_barcode/rghost_barcode_base_rb.html +0 -101
  100. data/lib/doc/files/rghost_barcode/rghost_barcode_classes_rb.html +0 -101
  101. data/lib/doc/files/rghost_barcode/rghost_barcode_examples_rb.html +0 -101
  102. data/lib/doc/files/rghost_barcode/rghost_barcode_version_rb.html +0 -101
  103. data/lib/doc/files/rghost_barcode_rb.html +0 -111
  104. data/lib/doc/files/teste_main_rb.html +0 -110
  105. data/lib/doc/fr_class_index.html +0 -67
  106. data/lib/doc/fr_file_index.html +0 -33
  107. data/lib/doc/fr_method_index.html +0 -74
  108. data/lib/doc/index.html +0 -24
  109. data/lib/rghost_barcode/ps/auspost.ps +0 -192
  110. data/lib/rghost_barcode/ps/azteccode.ps +0 -357
  111. data/lib/rghost_barcode/ps/barcode_template.eps +0 -1193
  112. data/lib/rghost_barcode/ps/code11.ps +0 -128
  113. data/lib/rghost_barcode/ps/code128.ps +0 -121
  114. data/lib/rghost_barcode/ps/code2of5.ps +0 -106
  115. data/lib/rghost_barcode/ps/code39.ps +0 -109
  116. data/lib/rghost_barcode/ps/code93.ps +0 -117
  117. data/lib/rghost_barcode/ps/datamatrix.ps +0 -328
  118. data/lib/rghost_barcode/ps/ean13.ps +0 -183
  119. data/lib/rghost_barcode/ps/ean2.ps +0 -101
  120. data/lib/rghost_barcode/ps/ean5.ps +0 -116
  121. data/lib/rghost_barcode/ps/ean8.ps +0 -101
  122. data/lib/rghost_barcode/ps/interleaved2of5.ps +0 -132
  123. data/lib/rghost_barcode/ps/isbn.ps +0 -118
  124. data/lib/rghost_barcode/ps/kix.ps +0 -98
  125. data/lib/rghost_barcode/ps/maxicode.ps +0 -307
  126. data/lib/rghost_barcode/ps/msi.ps +0 -104
  127. data/lib/rghost_barcode/ps/onecode.ps +0 -276
  128. data/lib/rghost_barcode/ps/pdf417.ps +0 -428
  129. data/lib/rghost_barcode/ps/pharmacode.ps +0 -69
  130. data/lib/rghost_barcode/ps/plessey.ps +0 -121
  131. data/lib/rghost_barcode/ps/postnet.ps +0 -114
  132. data/lib/rghost_barcode/ps/qrcode.ps +0 -530
  133. data/lib/rghost_barcode/ps/rationalizedcodabar.ps +0 -117
  134. data/lib/rghost_barcode/ps/raw.ps +0 -35
  135. data/lib/rghost_barcode/ps/render.ps +0 -307
  136. data/lib/rghost_barcode/ps/render.ps~ +0 -308
  137. data/lib/rghost_barcode/ps/royalmail.ps +0 -119
  138. data/lib/rghost_barcode/ps/rss14.ps +0 -237
  139. data/lib/rghost_barcode/ps/rssexpanded.ps +0 -211
  140. data/lib/rghost_barcode/ps/rsslimited.ps +0 -191
  141. data/lib/rghost_barcode/ps/symbol.ps +0 -49
  142. data/lib/rghost_barcode/ps/upca.ps +0 -128
  143. data/lib/rghost_barcode/ps/upce.ps +0 -157
  144. data/lib/rghost_barcode/rghost_barcode_classes.rb +0 -96
  145. data/lib/rghost_barcode/rghost_barcode_examples.rb +0 -35
  146. data/lib/teste_main.rb +0 -94
@@ -1,117 +0,0 @@
1
-
2
- % --DESC: Code 93
3
- % --EXAM: THIS IS CODE 93
4
- % --EXOP: includetext includecheck
5
- % --RNDR: renlinear
6
- /code93 {
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 % Enable/disable text
16
- /textfont /Courier def
17
- /textsize 10 def
18
- /textyoffset -7 def
19
- /height 1 def
20
-
21
- % Parse the input options
22
- options {
23
- token false eq {exit} if dup length string cvs (=) search
24
- true eq {cvlit exch pop exch def} {cvlit true def} ifelse
25
- } loop
26
-
27
- /textfont textfont cvlit def
28
- /textsize textsize cvr def
29
- /textyoffset textyoffset cvr def
30
- /height height cvr def
31
-
32
- /encs
33
- [ (131112) (111213) (111312) (111411) (121113)
34
- (121212) (121311) (111114) (131211) (141111)
35
- (211113) (211212) (211311) (221112) (221211)
36
- (231111) (112113) (112212) (112311) (122112)
37
- (132111) (111123) (111222) (111321) (121122)
38
- (131121) (212112) (212211) (211122) (211221)
39
- (221121) (222111) (112122) (112221) (122121)
40
- (123111) (121131) (311112) (311211) (321111)
41
- (112131) (113121) (211131) (121221) (312111)
42
- (311121) (122211) (111141) (1111411)
43
- ] def
44
-
45
- % Create a string of the available characters
46
- /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
47
-
48
- /barlen barcode length def % Length of the code
49
- barcode {
50
- (^) search false eq {pop exit} if
51
- pop pop /barlen barlen 3 sub def
52
- } loop
53
-
54
- includecheck {
55
- /sbs barlen 6 mul 25 add string def
56
- } {
57
- /sbs barlen 6 mul 13 add string def
58
- } ifelse
59
- /txt barlen array def
60
-
61
- % Put the start character
62
- sbs 0 encs 47 get putinterval
63
-
64
- /checksum1 0 def /checksum2 0 def
65
-
66
- /i 0 def /j 0 def
67
- { % loop
68
- j barlen eq {exit} if
69
- barcode i 1 getinterval (^) eq {
70
- % indx is given by the next three characters
71
- /indx barcode i 1 add 3 getinterval cvi def
72
- txt j [( ) j 9 mul 9 add textyoffset textfont textsize] put
73
- /i i 4 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 9 mul 9 add textyoffset textfont textsize] put
80
- /i i 1 add def
81
- } ifelse
82
- /enc encs indx get def % Get the indxth encoding
83
- sbs j 6 mul 6 add enc putinterval % Put encoded digit into sbs
84
- /checksum1 checksum1 barlen j sub 1 sub 20 mod 1 add indx mul add def
85
- /checksum2 checksum2 barlen j sub 15 mod 1 add indx mul add def
86
- /j j 1 add def
87
- } loop
88
-
89
- includecheck {
90
- % Put the first checksum character
91
- /checksum1 checksum1 47 mod def
92
- /checksum2 checksum2 checksum1 add 47 mod def
93
- sbs j 6 mul 6 add encs checksum1 get putinterval
94
- sbs j 6 mul 12 add encs checksum2 get putinterval
95
- % Put the end character
96
- sbs j 6 mul 18 add encs 48 get putinterval
97
- } {
98
- % Put the end character
99
- sbs j 6 mul 6 add encs 48 get putinterval
100
- } ifelse
101
-
102
- % Return the arguments
103
- /retval 8 dict def
104
- retval (ren) (renlinear) put
105
- retval (sbs) [sbs {48 sub} forall] put
106
- retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
107
- retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
108
- includetext {
109
- retval (txt) txt put
110
- } if
111
- retval (opt) useropts put
112
- retval
113
-
114
- end
115
-
116
- } bind def
117
- /code93 load 0 1 dict put
@@ -1,328 +0,0 @@
1
-
2
- % --DESC: Data Matrix
3
- % --EXAM: ^142^164^186
4
- % --EXOP: rows=32 columns=32
5
- % --RNDR: renmatrix
6
- /datamatrix {
7
-
8
- 0 begin
9
-
10
- /options exch def
11
- /useropts options def
12
- /barcode exch def
13
-
14
- /columns 0 def
15
- /rows 0 def
16
-
17
- % Parse the input options
18
- options {
19
- token false eq {exit} if dup length string cvs (=) search
20
- true eq {cvlit exch pop exch def} {cvlit true def} ifelse
21
- } loop
22
-
23
- /columns columns cvi def
24
- /rows rows cvi def
25
-
26
- % Split the input barcode into an array of codewords
27
- /cws barcode length array def
28
- /i 0 def /j 0 def
29
- { % loop
30
- i barcode length eq {exit} if
31
- /cw barcode i 1 add 3 getinterval cvi def
32
- cws j cw put
33
- /i i 4 add def
34
- /j j 1 add def
35
- } loop
36
- /cws cws 0 j getinterval def
37
-
38
- % Basic metrics for the each symbol
39
- % rows cols regh regv rscw rsbl
40
- /metrics [
41
- % Standard square symbols
42
- [ 10 10 1 1 5 1 ]
43
- [ 12 12 1 1 7 1 ]
44
- [ 14 14 1 1 10 1 ]
45
- [ 16 16 1 1 12 1 ]
46
- [ 18 18 1 1 14 1 ]
47
- [ 20 20 1 1 18 1 ]
48
- [ 22 22 1 1 20 1 ]
49
- [ 24 24 1 1 24 1 ]
50
- [ 26 26 1 1 28 1 ]
51
- [ 32 32 2 2 36 1 ]
52
- [ 36 36 2 2 42 1 ]
53
- [ 40 40 2 2 48 1 ]
54
- [ 44 44 2 2 56 1 ]
55
- [ 48 48 2 2 68 1 ]
56
- [ 52 52 2 2 84 2 ]
57
- [ 64 64 4 4 112 2 ]
58
- [ 72 72 4 4 144 4 ]
59
- [ 80 80 4 4 192 4 ]
60
- [ 88 88 4 4 224 4 ]
61
- [ 96 96 4 4 272 4 ]
62
- [ 104 104 4 4 336 6 ]
63
- [ 120 120 6 6 408 6 ]
64
- [ 132 132 6 6 496 8 ]
65
- [ 144 144 6 6 620 10 ]
66
- % Optional rectangular symbols
67
- [ 8 18 1 1 7 1 ]
68
- [ 8 32 1 2 11 1 ]
69
- [ 12 26 1 1 14 1 ]
70
- [ 12 36 1 2 18 1 ]
71
- [ 16 36 1 2 24 1 ]
72
- [ 16 48 1 2 28 1 ]
73
- ] def
74
-
75
- % Select metrics of an appropriate symbol
76
- /urows rows def
77
- /ucols columns def
78
- /i 0 def
79
- { % loop
80
- /m metrics i get def
81
- /rows m 0 get def % Rows in symbol
82
- /cols m 1 get def % Columns in symbol
83
- /regh m 2 get def % Horizontal regions
84
- /regv m 3 get def % Vertical regions
85
- /rscw m 4 get def % Error correction codewords
86
- /rsbl m 5 get def % Error correction blocks
87
- /mrows rows 2 regh mul sub def % Rows in the mapping matrix
88
- /mcols cols 2 regv mul sub def % Columns in the mapping matrix
89
- /rrows mrows regh idiv def % Rows per region
90
- /rcols mcols regv idiv def % Columns per region
91
- /ncws mrows mcols mul 8 idiv rscw sub def % Data codewords
92
- /okay true def
93
- cws length ncws gt {/okay false def} if
94
- urows 0 ne urows rows ne and {/okay false def} if
95
- ucols 0 ne ucols cols ne and {/okay false def} if
96
- okay {exit} if
97
- /i i 1 add def
98
- } loop
99
-
100
- % Extend cws to ncws codewords by addition of pseudo-randomised pad characters
101
- cws length ncws lt {
102
- /datlen cws length def
103
- /cws [ cws {} forall ncws datlen sub {129} repeat ] def
104
- datlen 1 add 1 ncws 1 sub {
105
- /i exch def
106
- i 1 add 149 mul 253 mod 1 add 129 add
107
- dup 254 gt {254 sub} if
108
- cws exch i exch put
109
- } for
110
- } if
111
-
112
- % De-interleave the codewords into blocks
113
- /cwbs rsbl array def % Array of data codeword blocks
114
- /ecbs rsbl array def % Array of error correction blocks
115
- 0 1 rsbl 1 sub {
116
- /i exch def
117
- cws length 1558 ne {
118
- /cwbsize cws length rsbl idiv def
119
- } {
120
- i 7 le {/cwbsize 156 def} {/cwbsize 155 def} ifelse
121
- } ifelse
122
- /cwb cwbsize array def
123
- 0 1 cwbsize 1 sub {
124
- /j exch def
125
- cwb j cws j rsbl mul i add get put
126
- } for
127
- cwbs i cwb put
128
- ecbs i [ rscw rsbl idiv {0} repeat ] put
129
- } for
130
-
131
- % Calculate the log and anti-log tables
132
- /rslog [ -255 255 {0} repeat ] def
133
- /rsalog [ 1 255 {0} repeat ] def
134
- 1 1 255 {
135
- /i exch def
136
- rsalog i rsalog i 1 sub get 2 mul put
137
- rsalog i get 256 ge { rsalog i rsalog i get 301 xor put } if
138
- rslog rsalog i get i put
139
- } for
140
-
141
- % Function to calculate the product in the field
142
- /rsprod {
143
- /y exch def
144
- /x exch def
145
- x y mul 0 ne {
146
- rsalog rslog x get rslog y get add 255 mod get
147
- } {
148
- 0
149
- } ifelse
150
- } bind def
151
-
152
- % Generate the coefficients
153
- /coeffs [ 1 rscw rsbl idiv {0} repeat ] def
154
- 1 1 rscw rsbl idiv {
155
- /i exch def
156
- coeffs i coeffs i 1 sub get put
157
- i 1 sub -1 1 {
158
- /j exch def
159
- coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
160
- } for
161
- coeffs 0 coeffs 0 get rsalog i get rsprod put
162
- } for
163
- /coeffs coeffs 0 coeffs length 1 sub getinterval def
164
-
165
- % Calculate the error correction codewords for each block
166
- 0 1 cwbs length 1 sub {
167
- /i exch def
168
- /cwb cwbs i get def
169
- /ecb ecbs i get def
170
- 0 1 cwb length 1 sub {
171
- /t exch cwb exch get ecb 0 get xor def
172
- ecb length 1 sub -1 0 {
173
- /j exch def
174
- /p ecb length j sub 1 sub def
175
- t 0 eq {
176
- ecb p 0 put
177
- } {
178
- ecb p rsalog rslog t get rslog coeffs j get get add 255 mod get put
179
- } ifelse
180
- j 0 gt { ecb p ecb p 1 add get ecb p get xor put } if
181
- } for
182
- } for
183
- ecbs i ecb put
184
- } for
185
-
186
- % Extend codewords with the interleaved error correction codes
187
- /cws [ cws {} forall rscw {0} repeat ] def
188
- 0 1 rscw 1 sub {
189
- /i exch def
190
- cws ncws i add ecbs i rsbl mod get i rsbl idiv get put
191
- } for
192
-
193
- % Create the module placement matrix
194
- /module {
195
- /tmpc exch def
196
- /tmpr exch def
197
- tmpr 0 lt {
198
- /tmpr tmpr mrows add def
199
- /tmpc tmpc 4 mrows 4 add 8 mod sub add def
200
- } if
201
- tmpc 0 lt {
202
- /tmpc tmpc mcols add def
203
- /tmpr tmpr 4 mcols 4 add 8 mod sub add def
204
- } if
205
- mmat tmpr mcols mul tmpc add bit put
206
- /bit bit 1 add def
207
- } bind def
208
-
209
- /mmat [ mrows mcols mul {-1} repeat ] def
210
- /bit 0 def /row 4 def /col 0 def
211
- { % loop
212
-
213
- row mrows eq col 0 eq and {
214
- [ [mrows 1 sub 0] [mrows 1 sub 1] [mrows 1 sub 2] [0 mcols 2 sub]
215
- [0 mcols 1 sub] [1 mcols 1 sub] [2 mcols 1 sub] [3 mcols 1 sub] ]
216
- {{} forall module} forall
217
- } if
218
- row mrows 2 sub eq col 0 eq and mcols 4 mod 0 ne and {
219
- [ [mrows 3 sub 0] [mrows 2 sub 0] [mrows 1 sub 0] [0 mcols 4 sub]
220
- [0 mcols 3 sub] [0 mcols 2 sub] [0 mcols 1 sub] [1 mcols 1 sub] ]
221
- {{} forall module} forall
222
- } if
223
- row mrows 2 sub eq col 0 eq and mcols 8 mod 4 eq and {
224
- [ [mrows 3 sub 0] [mrows 2 sub 0] [mrows 1 sub 0] [0 mcols 2 sub]
225
- [0 mcols 1 sub] [1 mcols 1 sub] [2 mcols 1 sub] [3 mcols 1 sub] ]
226
- {{} forall module} forall
227
- } if
228
- row mrows 4 add eq col 2 eq and mcols 8 mod 0 eq and {
229
- [ [mrows 1 sub 0] [mrows 1 sub mcols 1 sub] [0 mcols 3 sub] [0 mcols 2 sub]
230
- [0 mcols 1 sub] [1 mcols 3 sub] [1 mcols 2 sub] [1 mcols 1 sub] ]
231
- {{} forall module} forall
232
- } if
233
-
234
- { % loop for sweeping upwards
235
- row mrows lt col 0 ge and {
236
- mmat row mcols mul col add get -1 eq {
237
- [ [row 2 sub col 2 sub] [row 2 sub col 1 sub] [row 1 sub col 2 sub] [row 1 sub col 1 sub]
238
- [row 1 sub col] [row col 2 sub] [row col 1 sub] [row col] ]
239
- {{} forall module} forall
240
- } if
241
- } if
242
- /row row 2 sub def
243
- /col col 2 add def
244
- row 0 ge col mcols lt and not {exit} if
245
- } loop
246
- /row row 1 add def
247
- /col col 3 add def
248
-
249
- { % loop for sweeping downwards
250
- row 0 ge col mcols lt and {
251
- mmat row mcols mul col add get -1 eq {
252
- [ [row 2 sub col 2 sub] [row 2 sub col 1 sub] [row 1 sub col 2 sub] [row 1 sub col 1 sub]
253
- [row 1 sub col] [row col 2 sub] [row col 1 sub] [row col] ]
254
- {{} forall module} forall
255
- } if
256
- } if
257
- /row row 2 add def
258
- /col col 2 sub def
259
- row mrows lt col 0 ge and not {exit} if
260
- } loop
261
- /row row 3 add def
262
- /col col 1 add def
263
-
264
- row mrows lt col mcols lt or not {exit} if
265
- } loop
266
-
267
- % Set checker pattern if required
268
- mmat mrows mcols mul 1 sub get -1 eq {
269
- mmat mrows mcols 1 sub mul 2 sub [-1 -2] putinterval
270
- mmat mrows mcols mul 2 sub [-2 -1] putinterval
271
- } if
272
-
273
- % Invert the map to form the mapping matrix correcting the checker case
274
- /modmap mrows mcols mul 8 idiv 8 mul array def
275
- 0 1 mmat length 1 sub {
276
- /i exch def
277
- mmat i get 0 ge {
278
- modmap mmat i get i put
279
- } {
280
- mmat i mmat i get 2 add put
281
- } ifelse
282
- } for
283
-
284
- % Place the codewords in the matrix according to the mapping matrix
285
- 0 1 cws length 1 sub {
286
- /i exch def
287
- [ 8 {0} repeat cws i get 2 8 string cvrs {48 sub} forall ]
288
- dup length 8 sub 8 getinterval /bits exch def
289
- 0 1 7 {
290
- /j exch def
291
- mmat modmap i 8 mul j add get bits j get put
292
- } for
293
- } for
294
-
295
- % Place the modules onto a pixel map between alignment patterns
296
- /pixs rows cols mul array def
297
- /cwpos 0 def
298
- 0 1 rows 1 sub {
299
- /i exch def
300
- i rrows 2 add mod 0 eq { pixs i cols mul [ cols 2 idiv {1 0} repeat ] putinterval } if
301
- i rrows 2 add mod rrows 1 add eq { pixs i cols mul [ cols {1} repeat ] putinterval } if
302
- i rrows 2 add mod 0 ne i rrows 2 add mod rrows 1 add ne and {
303
- 0 1 cols 1 sub {
304
- /j exch def
305
- j rcols 2 add mod 0 eq { pixs i cols mul j add 1 put } if
306
- j rcols 2 add mod rcols 1 add eq { pixs i cols mul j add i 2 mod put } if
307
- j rcols 2 add mod 0 ne j rcols 2 add mod rcols 1 add ne and {
308
- pixs i cols mul j add mmat cwpos get put
309
- /cwpos cwpos 1 add def
310
- } if
311
- } for
312
- } if
313
- } for
314
-
315
- /retval 7 dict def
316
- retval (ren) (renmatrix) put
317
- retval (pixs) pixs put
318
- retval (pixx) cols put
319
- retval (pixy) rows put
320
- retval (height) rows 72 div 1.5 mul put
321
- retval (width) cols 72 div 1.5 mul put
322
- retval (opt) useropts put
323
- retval
324
-
325
- end
326
-
327
- } bind def
328
- /datamatrix load 0 1 dict put
@@ -1,183 +0,0 @@
1
- %!PS-Adobe-2.0
2
- %%Creator: Terry Burton
3
- %%DocumentPaperSizes: a4
4
- %%EndComments
5
- %%EndProlog
6
-
7
- % Barcode Writer in Pure PostScript - Version 2008-04-06-1
8
- % http://www.terryburton.co.uk/barcodewriter/
9
- %
10
- % Copyright (c) 2008 Terry Burton - tez@terryburton.co.uk
11
- %
12
- % Permission is hereby granted, free of charge, to any
13
- % person obtaining a copy of this software and associated
14
- % documentation files (the "Software"), to deal in the
15
- % Software without restriction, including without
16
- % limitation the rights to use, copy, modify, merge,
17
- % publish, distribute, sublicense, and/or sell copies of
18
- % the Software, and to permit persons to whom the Software
19
- % is furnished to do so, subject to the following
20
- % conditions:
21
- %
22
- % The above copyright notice and this permission notice
23
- % shall be included in all copies or substantial portions
24
- % of the Software.
25
- %
26
- % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
27
- % KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
28
- % THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
29
- % PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30
- % THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
31
- % DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
32
- % CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33
- % CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34
- % IN THE SOFTWARE.
35
-
36
- % Uncomment this next line to allow these procedure definitions to
37
- % remain resident within a printer's PostScript virtual machine
38
- % so that the barcode generation capability persists between jobs.
39
-
40
- % serverdict begin 0 exitserver
41
-
42
- % --BEGIN TEMPLATE--
43
-
44
- % --DESC: EAN-13
45
- % --EXAM: 977147396801
46
- % --EXOP: includetext guardwhitespace
47
- % --RNDR: renlinear
48
- /ean13 {
49
-
50
- 0 begin
51
-
52
- /options exch def % We are given an option string
53
- /useropts options def
54
- /barcode exch def % We are given a barcode string
55
-
56
- /includetext false def % Enable/disable text
57
- /textfont /Helvetica def
58
- /textsize 12 def
59
- /textyoffset -4 def
60
- /height 1 def
61
-
62
- % Parse the input options
63
- options {
64
- token false eq {exit} if dup length string cvs (=) search
65
- true eq {cvlit exch pop exch def} {cvlit true def} ifelse
66
- } loop
67
-
68
- /textfont textfont cvlit def
69
- /textsize textsize cvr def
70
- /textyoffset textyoffset cvr def
71
- /height height cvr def
72
-
73
- /barlen barcode length def % Length of the code
74
-
75
- % Add checksum digit to barcode if length is even
76
- barlen 2 mod 0 eq {
77
- /pad barlen 1 add string def % Create pad one bigger than barcode
78
- /checksum 0 def
79
- 0 1 barlen 1 sub {
80
- /i exch def
81
- /barchar barcode i get 48 sub def
82
- i 2 mod 0 eq {
83
- /checksum barchar checksum add def
84
- } {
85
- /checksum barchar 3 mul checksum add def
86
- } ifelse
87
- } for
88
- /checksum 10 checksum 10 mod sub 10 mod def
89
- pad 0 barcode putinterval % Add barcode to the start of the pad
90
- pad barlen checksum 48 add put % Put ascii for checksum at end of pad
91
- /barcode pad def % barcode=pad
92
- /barlen barlen 1 add def % barlen++
93
- } if
94
-
95
- % Create an array containing the character mappings
96
- /encs
97
- [ (3211) (2221) (2122) (1411) (1132)
98
- (1231) (1114) (1312) (1213) (3112)
99
- (111) (11111) (111)
100
- ] def
101
-
102
- % Create a string of the available characters
103
- /barchars (0123456789) def
104
-
105
- % Digits to mirror on left side
106
- /mirrormaps
107
- [ (000000) (001011) (001101) (001110) (010011)
108
- (011001) (011100) (010101) (010110) (011010)
109
- ] def
110
-
111
- /sbs barlen 1 sub 4 mul 11 add string def
112
- /txt barlen array def
113
-
114
- % Put the start character
115
- sbs 0 encs 10 get putinterval
116
-
117
- % First digit - determine mirrormap by this and show before guard bars
118
- /mirrormap mirrormaps barcode 0 get 48 sub get def
119
- txt 0 [barcode 0 1 getinterval -10 textyoffset textfont textsize] put
120
-
121
- % Left side - performs mirroring
122
- 1 1 6 {
123
- % Lookup the encoding for the each barcode character
124
- /i exch def
125
- barcode i 1 getinterval barchars exch search
126
- pop % Discard true leaving pre
127
- length /indx exch def % indx is the length of pre
128
- pop pop % Discard seek and post
129
- /enc encs indx get def % Get the indxth encoding
130
- mirrormap i 1 sub get 49 eq { % Reverse enc if 1 in this position in mirrormap
131
- /enclen enc length def
132
- /revenc enclen string def
133
- 0 1 enclen 1 sub {
134
- /j exch def
135
- /char enc j get def
136
- revenc enclen j sub 1 sub char put
137
- } for
138
- /enc revenc def
139
- } if
140
- sbs i 1 sub 4 mul 3 add enc putinterval % Put encoded digit into sbs
141
- txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textyoffset textfont textsize] put
142
- } for
143
-
144
- % Put the middle character
145
- sbs 7 1 sub 4 mul 3 add encs 11 get putinterval
146
-
147
- % Right side
148
- 7 1 12 {
149
- % Lookup the encoding for the each barcode character
150
- /i exch def
151
- barcode i 1 getinterval barchars exch search
152
- pop % Discard true leaving pre
153
- length /indx exch def % indx is the length of pre
154
- pop pop % Discard seek and post
155
- /enc encs indx get def % Get the indxth encoding
156
- sbs i 1 sub 4 mul 8 add enc putinterval % Put encoded digit into sbs
157
- txt i [barcode i 1 getinterval i 1 sub 7 mul 8 add textyoffset textfont textsize] put
158
- } for
159
-
160
- % Put the end character
161
- sbs barlen 1 sub 4 mul 8 add encs 12 get putinterval
162
-
163
- % Return the arguments
164
- /retval 8 dict def
165
- retval (ren) (renlinear) put
166
- retval (sbs) [sbs {48 sub} forall] put
167
- includetext {
168
- retval (bhs) [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] put
169
- retval (bbs) [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] put
170
- retval (txt) txt put
171
- } {
172
- retval (bhs) [30{height}repeat] put
173
- retval (bbs) [30{0}repeat] put
174
- } ifelse
175
- retval (opt) useropts put
176
- retval (guardrightpos) 10 put
177
- retval (borderbottom) 5 put
178
- retval
179
-
180
- end
181
-
182
- } bind def
183
- /ean13 load 0 1 dict put