pdf417 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ A wrapper for the pdf417lib C Library, from the README:
4
4
 
5
5
  A library to generate the 2D barcode PDF417
6
6
 
7
- Project: http://sourceforge.net/projects/pdf417.lib
7
+ Project: http://pdf417lib.sourceforge.net/
8
8
  Creator: Paulo Soares (psoares@consiste.pt)
9
9
  License: LGPL or MPL 1.1
10
10
 
@@ -23,13 +23,19 @@ There are a few ways to use the library, at its simplest:
23
23
 
24
24
  PDF417.encode_text("readable barcode data") => [12, 827, 120, 90, 41, 146, 30, 512, 423, 146, 90, 570]
25
25
 
26
- If you want to get the bitmap:
26
+ If you want to get the raw barcode data from the PDF417 library:
27
27
 
28
28
  barcode = PDF417.new("readable barcode data")
29
29
  barcode.to_blob # oops, wrong text
30
30
  barcode.text = "ACTUAL barcode data"
31
31
  barcode.to_blob
32
32
 
33
+ If you want to get it as an array of strings (each array element representing a line)
34
+ barcode.encoding
35
+
36
+ If you have chunky_png installed and you'd rather have a PNG
37
+ barcode.to_png
38
+
33
39
  See the RDocs for more information.
34
40
 
35
41
  == Note on Patches/Pull Requests
data/Rakefile CHANGED
@@ -61,5 +61,6 @@ end
61
61
  desc 'rebuilds the pdf417 library'
62
62
  task :build_extension do
63
63
  pwd = `pwd`
64
- exec "cd ext/pdf417 && make clean && ruby extconf.rb && make && cd #{pwd}"
64
+ system "cd ext/pdf417 && make clean"
65
+ system "cd ext/pdf417 && ruby extconf.rb && make"
65
66
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -4,11 +4,11 @@ SHELL = /bin/sh
4
4
  #### Start of system configuration section. ####
5
5
 
6
6
  srcdir = .
7
- topdir = /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/i686-darwin10.3.0
7
+ topdir = /opt/rubyEE/lib/ruby/1.8/i686-darwin10.3.0
8
8
  hdrdir = $(topdir)
9
9
  VPATH = $(srcdir):$(topdir):$(hdrdir)
10
10
  exec_prefix = $(prefix)
11
- prefix = $(DESTDIR)/opt/ruby-enterprise-1.8.7-2010.01
11
+ prefix = $(DESTDIR)/opt/rubyEE
12
12
  sharedstatedir = $(prefix)/com
13
13
  mandir = $(datarootdir)/man
14
14
  psdir = $(docdir)
@@ -62,7 +62,7 @@ RUBY_SO_NAME = ruby
62
62
  arch = i686-darwin10.3.0
63
63
  sitearch = i686-darwin10.3.0
64
64
  ruby_version = 1.8
65
- ruby = /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
65
+ ruby = /opt/rubyEE/bin/ruby
66
66
  RUBY = $(ruby)
67
67
  RM = rm -f
68
68
  MAKEDIRS = mkdir -p
@@ -1,5 +1,6 @@
1
1
  /* NOTE: This relies on the PDF417 Library from http://sourceforge.net/projects/pdf417lib and is included here
2
- *
2
+ * It is a little odd and not too C-like, because it is called 'pdf417' but defines both the PDF417 and the PDF417::Lib
3
+ * class. Note that the majority of the functions are for the PDF417::Lib class, the PDF417 class is only a placeholder.
3
4
  */
4
5
 
5
6
  #include <ruby.h>
@@ -27,21 +28,22 @@
27
28
 
28
29
  // The initialization method for this module
29
30
  void Init_pdf417() {
30
- rb_cPdf417 = rb_define_class("PDF417", rb_cObject);
31
- rb_define_singleton_method(rb_cPdf417, "encode_text", rb_pdf417_encode_text, 1);
32
- rb_define_singleton_method(rb_cPdf417, "new", rb_pdf417_new, 1);
33
- rb_define_method(rb_cPdf417, "initialize", rb_pdf417_init, 1);
34
- rb_define_method(rb_cPdf417, "codewords", rb_pdf417_codewords, 0);
35
- rb_define_method(rb_cPdf417, "to_blob", rb_pdf417_to_blob, 0);
36
- rb_define_method(rb_cPdf417, "bit_columns", rb_pdf417_bitColumns, 0);
37
- rb_define_method(rb_cPdf417, "bit_length", rb_pdf417_lenBits, 0);
38
- rb_define_method(rb_cPdf417, "code_rows", rb_pdf417_codeRows, 0);
39
- rb_define_method(rb_cPdf417, "code_columns", rb_pdf417_codeColumns, 0);
40
- rb_define_method(rb_cPdf417, "codeword_length", rb_pdf417_lenCodewords, 0);
41
- rb_define_method(rb_cPdf417, "error_level", rb_pdf417_errorLevel, 0);
42
- rb_define_method(rb_cPdf417, "aspect_ratio", rb_pdf417_aspectRatio, 0);
43
- rb_define_method(rb_cPdf417, "y_height", rb_pdf417_yHeight, 0);
44
- rb_define_method(rb_cPdf417, "generation_error", rb_pdf417_error, 0);
31
+ rb_cPdf417 = rb_define_class("PDF417", rb_cObject); // Our PDF417 object
32
+ rb_cPdf417_Lib = rb_define_class_under(rb_cPdf417, "Lib", rb_cObject); // Our PDF417::Lib object, to represent the C file
33
+ rb_define_singleton_method(rb_cPdf417_Lib, "encode_text", rb_pdf417_lib_encode_text, 1);
34
+ rb_define_singleton_method(rb_cPdf417_Lib, "new", rb_pdf417_lib_new, 1);
35
+ rb_define_method(rb_cPdf417_Lib, "initialize", rb_pdf417_lib_init, 1);
36
+ rb_define_method(rb_cPdf417_Lib, "codewords", rb_pdf417_lib_codewords, 0);
37
+ rb_define_method(rb_cPdf417_Lib, "to_blob", rb_pdf417_lib_to_blob, 0);
38
+ rb_define_method(rb_cPdf417_Lib, "bit_columns", rb_pdf417_lib_bitColumns, 0);
39
+ rb_define_method(rb_cPdf417_Lib, "bit_length", rb_pdf417_lib_lenBits, 0);
40
+ rb_define_method(rb_cPdf417_Lib, "code_rows", rb_pdf417_lib_codeRows, 0);
41
+ rb_define_method(rb_cPdf417_Lib, "code_cols", rb_pdf417_lib_codeColumns, 0);
42
+ rb_define_method(rb_cPdf417_Lib, "codeword_length", rb_pdf417_lib_lenCodewords, 0);
43
+ rb_define_method(rb_cPdf417_Lib, "error_level", rb_pdf417_lib_errorLevel, 0);
44
+ rb_define_method(rb_cPdf417_Lib, "aspect_ratio", rb_pdf417_lib_aspectRatio, 0);
45
+ rb_define_method(rb_cPdf417_Lib, "y_height", rb_pdf417_lib_yHeight, 0);
46
+ rb_define_method(rb_cPdf417_Lib, "generation_error", rb_pdf417_lib_error, 0);
45
47
  }
46
48
 
47
49
  /*
@@ -50,7 +52,7 @@ void Init_pdf417() {
50
52
  *
51
53
  * Returns an array of integers showing the codewords
52
54
  */
53
- static VALUE rb_pdf417_encode_text(VALUE self, VALUE text) {
55
+ static VALUE rb_pdf417_lib_encode_text(VALUE self, VALUE text) {
54
56
  VALUE list;
55
57
  int k;
56
58
 
@@ -74,12 +76,12 @@ static VALUE rb_pdf417_encode_text(VALUE self, VALUE text) {
74
76
  }
75
77
 
76
78
  /* :nodoc: */
77
- static void rb_pdf417_cleanup(void *p) {
79
+ static void rb_pdf417_lib_cleanup(void *p) {
78
80
  pdf417free(p);
79
81
  }
80
82
 
81
83
  /* :nodoc: */
82
- static VALUE rb_pdf417_init(VALUE self, VALUE text) {
84
+ static VALUE rb_pdf417_lib_init(VALUE self, VALUE text) {
83
85
  rb_iv_set(self, "@text", text);
84
86
  return self;
85
87
  }
@@ -90,10 +92,10 @@ static VALUE rb_pdf417_init(VALUE self, VALUE text) {
90
92
  *
91
93
  * Makes a new PDF417 object for the given text string
92
94
  */
93
- static VALUE rb_pdf417_new(VALUE class, VALUE text) {
95
+ static VALUE rb_pdf417_lib_new(VALUE class, VALUE text) {
94
96
  VALUE argv[1];
95
97
  pdf417param *ptr;
96
- VALUE tdata = Data_Make_Struct(class, pdf417param, 0, rb_pdf417_cleanup, ptr);
98
+ VALUE tdata = Data_Make_Struct(class, pdf417param, 0, rb_pdf417_lib_cleanup, ptr);
97
99
  pdf417init(ptr);
98
100
  rb_iv_set(tdata, "@generation_options", INT2NUM(ptr->options));
99
101
  argv[0] = text;
@@ -107,23 +109,29 @@ static VALUE rb_pdf417_new(VALUE class, VALUE text) {
107
109
  *
108
110
  * Generates an array of codewords from the current text attribute
109
111
  */
110
- static VALUE rb_pdf417_codewords(VALUE self) {
111
- VALUE list;
112
+ static VALUE rb_pdf417_lib_codewords(VALUE self) {
113
+ VALUE list, text;
112
114
  int k;
113
- pdf417param *ptr;
114
- Data_Get_Struct(self, pdf417param, ptr);
115
- refreshStruct(self, ptr);
116
- if (ptr->error) {
117
- return Qnil; //could also return list
115
+ pdf417param p;
116
+
117
+
118
+ text = rb_iv_get(self, "@text");
119
+ pdf417init(&p);
120
+ p.text = StringValuePtr(text);
121
+ fetchCodewords(&p);
122
+ if (p.error) {
123
+ pdf417free(&p);
124
+ return Qnil; //could also return list or raise something
118
125
  }
119
126
 
120
- list = rb_ary_new2(ptr->lenCodewords);
127
+ list = rb_ary_new2(p.lenCodewords);
128
+
129
+ pdf417free(&p);
121
130
 
122
- // The first codeword is the length of the data, which is all we're interested in here.
123
- for (k = 0; k < ptr->codewords[0]; ++k) {
124
- rb_ary_push(list, INT2NUM(ptr->codewords[k]));
131
+ for (k = 0; k < p.lenCodewords; ++k) {
132
+ rb_ary_push(list, INT2NUM(p.codewords[k]));
125
133
  }
126
- return list;
134
+ return list;
127
135
  }
128
136
 
129
137
  /*
@@ -132,11 +140,63 @@ static VALUE rb_pdf417_codewords(VALUE self) {
132
140
  *
133
141
  * Returns a binary string representing the image bits, requires scaling before display
134
142
  */
135
- static VALUE rb_pdf417_to_blob(VALUE self) {
143
+ static VALUE rb_pdf417_lib_to_blob(VALUE self) {
144
+ VALUE generation_options, text, aspect_ratio, raw_codewords, y_height, error_level, code_rows, code_cols;
136
145
  pdf417param *ptr;
146
+ int options = 0;
147
+
137
148
  Data_Get_Struct(self, pdf417param, ptr);
138
- refreshStruct(self, ptr);
139
- if (ptr->error) {
149
+ generation_options = rb_iv_get(self, "@generation_options");
150
+ text = rb_iv_get(self, "@text");
151
+ aspect_ratio = rb_iv_get(self, "@aspect_ratio");
152
+ raw_codewords = rb_iv_get(self, "@raw_codewords");
153
+ y_height = rb_iv_get(self, "@y_height");
154
+ error_level = rb_iv_get(self, "@error_level");
155
+ code_rows = rb_iv_get(self, "@code_rows");
156
+ code_cols = rb_iv_get(self, "@code_cols");
157
+
158
+ // re-set our internal variables
159
+ pdf417init(ptr);
160
+
161
+ // Always set the text, can't really go wrong here
162
+ ptr->text = StringValuePtr(text);
163
+
164
+ // Start setting them based off of what we got
165
+ if ( TYPE(generation_options) == T_FIXNUM ){
166
+ ptr->options = FIX2INT(generation_options);
167
+ }
168
+
169
+ if ( TYPE(aspect_ratio) == T_FLOAT ){
170
+ ptr->aspectRatio = (float)NUM2DBL(aspect_ratio);
171
+ }
172
+
173
+ if ( TYPE(y_height) == T_FLOAT ){
174
+ ptr->yHeight = (float)NUM2DBL(y_height);
175
+ }
176
+
177
+ if ( TYPE(error_level) == T_FIXNUM ){
178
+ ptr->errorLevel = FIX2INT(error_level);
179
+ }
180
+
181
+ if ( TYPE(code_rows) == T_FIXNUM ){
182
+ ptr->codeRows = FIX2INT(code_rows);
183
+ }
184
+
185
+ if ( TYPE(code_cols) == T_FIXNUM ){
186
+ ptr->codeColumns = FIX2INT(code_cols);
187
+ }
188
+
189
+ if ( TYPE(raw_codewords) == T_ARRAY && ptr->options & PDF417_USE_RAW_CODEWORDS){
190
+ ptr->lenCodewords = RARRAY_LEN(raw_codewords);
191
+ int k;
192
+ for (k = 0; k < ptr->lenCodewords; ++k) {
193
+ ptr->codewords[k] = FIX2INT(rb_ary_entry(raw_codewords, k));
194
+ }
195
+ }
196
+
197
+ paintCode(ptr);
198
+
199
+ if (ptr->error && ptr->error != PDF417_ERROR_SUCCESS) {
140
200
  return Qnil; //could also return list
141
201
  }
142
202
 
@@ -149,7 +209,7 @@ static VALUE rb_pdf417_to_blob(VALUE self) {
149
209
  *
150
210
  * The number of column bits in the bitmap
151
211
  */
152
- static VALUE rb_pdf417_bitColumns(VALUE self) {
212
+ static VALUE rb_pdf417_lib_bitColumns(VALUE self) {
153
213
  pdf417param *ptr;
154
214
  Data_Get_Struct(self, pdf417param, ptr);
155
215
  return INT2NUM(ptr->bitColumns);
@@ -161,7 +221,7 @@ static VALUE rb_pdf417_bitColumns(VALUE self) {
161
221
  *
162
222
  * The size in bytes of the bitmap
163
223
  */
164
- static VALUE rb_pdf417_lenBits(VALUE self) {
224
+ static VALUE rb_pdf417_lib_lenBits(VALUE self) {
165
225
  pdf417param *ptr;
166
226
  Data_Get_Struct(self, pdf417param, ptr);
167
227
  return INT2NUM(ptr->lenBits);
@@ -173,7 +233,7 @@ static VALUE rb_pdf417_lenBits(VALUE self) {
173
233
  *
174
234
  * The number of code rows and bitmap lines
175
235
  */
176
- static VALUE rb_pdf417_codeRows(VALUE self) {
236
+ static VALUE rb_pdf417_lib_codeRows(VALUE self) {
177
237
  pdf417param *ptr;
178
238
  Data_Get_Struct(self, pdf417param, ptr);
179
239
  return INT2NUM(ptr->codeRows);
@@ -181,11 +241,11 @@ static VALUE rb_pdf417_codeRows(VALUE self) {
181
241
 
182
242
  /*
183
243
  * call-seq:
184
- * code_columns
244
+ * code_cols
185
245
  *
186
246
  * The number of code columns
187
247
  */
188
- static VALUE rb_pdf417_codeColumns(VALUE self) {
248
+ static VALUE rb_pdf417_lib_codeColumns(VALUE self) {
189
249
  pdf417param *ptr;
190
250
  Data_Get_Struct(self, pdf417param, ptr);
191
251
  return INT2NUM(ptr->codeColumns);
@@ -197,7 +257,7 @@ static VALUE rb_pdf417_codeColumns(VALUE self) {
197
257
  *
198
258
  * The size of the code words, including error correction codes
199
259
  */
200
- static VALUE rb_pdf417_lenCodewords(VALUE self) {
260
+ static VALUE rb_pdf417_lib_lenCodewords(VALUE self) {
201
261
  pdf417param *ptr;
202
262
  Data_Get_Struct(self, pdf417param, ptr);
203
263
  return INT2NUM(ptr->lenCodewords);
@@ -209,7 +269,7 @@ static VALUE rb_pdf417_lenCodewords(VALUE self) {
209
269
  *
210
270
  * The error level required 0-8
211
271
  */
212
- static VALUE rb_pdf417_errorLevel(VALUE self){
272
+ static VALUE rb_pdf417_lib_errorLevel(VALUE self){
213
273
  pdf417param *ptr;
214
274
  Data_Get_Struct(self, pdf417param, ptr);
215
275
  return INT2NUM(ptr->errorLevel);
@@ -221,7 +281,7 @@ static VALUE rb_pdf417_errorLevel(VALUE self){
221
281
  *
222
282
  * The y/x aspect ratio
223
283
  */
224
- static VALUE rb_pdf417_aspectRatio(VALUE self){
284
+ static VALUE rb_pdf417_lib_aspectRatio(VALUE self){
225
285
  pdf417param *ptr;
226
286
  Data_Get_Struct(self, pdf417param, ptr);
227
287
  return rb_float_new(ptr->aspectRatio);
@@ -233,7 +293,7 @@ static VALUE rb_pdf417_aspectRatio(VALUE self){
233
293
  *
234
294
  * The y/x dot ratio
235
295
  */
236
- static VALUE rb_pdf417_yHeight(VALUE self){
296
+ static VALUE rb_pdf417_lib_yHeight(VALUE self){
237
297
  pdf417param *ptr;
238
298
  Data_Get_Struct(self, pdf417param, ptr);
239
299
  return rb_float_new(ptr->yHeight);
@@ -248,34 +308,8 @@ static VALUE rb_pdf417_yHeight(VALUE self){
248
308
  * [PDF417_ERROR_TEXT_TOO_BIG] the text was too big the PDF417 specifications
249
309
  * [PDF417_ERROR_INVALID_PARAMS] invalid parameters. Only used with PDF417_USE_RAW_CODEWORDS
250
310
  */
251
- static VALUE rb_pdf417_error(VALUE self){
311
+ static VALUE rb_pdf417_lib_error(VALUE self){
252
312
  pdf417param *ptr;
253
313
  Data_Get_Struct(self, pdf417param, ptr);
254
314
  return INT2NUM(ptr->error);
255
315
  }
256
-
257
- // Refresh the PDF417 struct containing our data if anything important has changed.
258
- static void refreshStruct(VALUE self, pdf417param *ptr) {
259
-
260
- char* text = STR2CSTR(rb_iv_get(self, "@text"));
261
- int options = 0;
262
- VALUE generation_options = rb_iv_get(self, "@generation_options");
263
-
264
- if ( TYPE(generation_options) == T_FIXNUM ){
265
- options = FIX2INT(generation_options);
266
- }
267
-
268
- // Only re-do it if our text has changed
269
- if ( 0 != strcmp(ptr->text, text) || options != ptr->options) {
270
- ptr->options = options;
271
- ptr->outBits = NULL;
272
- ptr->lenBits = 0;
273
- ptr->error = 0;
274
- ptr->lenText = -1;
275
- ptr->text = "";
276
- ptr->yHeight = 3;
277
- ptr->aspectRatio = 0.5;
278
- ptr->text = STR2CSTR(rb_iv_get(self, "@text"));
279
- paintCode(ptr); //paintCode also sets the error correction, we call it here so we can get the blob if needed w/o trouble
280
- }
281
- }
@@ -1,18 +1,18 @@
1
1
 
2
2
  VALUE rb_cPdf417;
3
- static VALUE rb_pdf417_encode_text(VALUE self, VALUE text);
4
- static VALUE rb_pdf417_codewords(VALUE self);
5
- static VALUE rb_pdf417_to_blob(VALUE self);
6
- static VALUE rb_pdf417_new(VALUE class, VALUE text);
7
- static void rb_pdf417_cleanup(void *p);
8
- static VALUE rb_pdf417_init(VALUE self, VALUE text);
9
- static VALUE rb_pdf417_bitColumns(VALUE self);
10
- static VALUE rb_pdf417_lenBits(VALUE self);
11
- static VALUE rb_pdf417_codeRows(VALUE self);
12
- static VALUE rb_pdf417_codeColumns(VALUE self);
13
- static VALUE rb_pdf417_lenCodewords(VALUE self);
14
- static VALUE rb_pdf417_errorLevel(VALUE self);
15
- static VALUE rb_pdf417_aspectRatio(VALUE self);
16
- static VALUE rb_pdf417_yHeight(VALUE self);
17
- static VALUE rb_pdf417_error(VALUE self);
18
- static void refreshStruct(VALUE self, pdf417param *ptr);
3
+ VALUE rb_cPdf417_Lib;
4
+ static VALUE rb_pdf417_lib_encode_text(VALUE self, VALUE text);
5
+ static VALUE rb_pdf417_lib_codewords(VALUE self);
6
+ static VALUE rb_pdf417_lib_to_blob(VALUE self);
7
+ static VALUE rb_pdf417_lib_new(VALUE class, VALUE text);
8
+ static void rb_pdf417_lib_cleanup(void *p);
9
+ static VALUE rb_pdf417_lib_init(VALUE self, VALUE text);
10
+ static VALUE rb_pdf417_lib_bitColumns(VALUE self);
11
+ static VALUE rb_pdf417_lib_lenBits(VALUE self);
12
+ static VALUE rb_pdf417_lib_codeRows(VALUE self);
13
+ static VALUE rb_pdf417_lib_codeColumns(VALUE self);
14
+ static VALUE rb_pdf417_lib_lenCodewords(VALUE self);
15
+ static VALUE rb_pdf417_lib_errorLevel(VALUE self);
16
+ static VALUE rb_pdf417_lib_aspectRatio(VALUE self);
17
+ static VALUE rb_pdf417_lib_yHeight(VALUE self);
18
+ static VALUE rb_pdf417_lib_error(VALUE self);
@@ -1,50 +1,232 @@
1
1
  require 'pdf417/pdf417'
2
+ require 'pdf417/lib'
2
3
 
3
4
  class PDF417
4
5
 
5
- PDF417_USE_ASPECT_RATIO = 0
6
- PDF417_FIXED_RECTANGLE = 1
7
- PDF417_FIXED_COLUMNS = 2
8
- PDF417_FIXED_ROWS = 4
9
- PDF417_AUTO_ERROR_LEVEL = 0
10
- PDF417_USE_ERROR_LEVEL = 16
11
- PDF417_USE_RAW_CODEWORDS = 64
12
- PDF417_INVERT_BITMAP = 128
6
+ class GenerationError < StandardError; end
7
+
8
+ class << self
9
+ def encode_text(text)
10
+ PDF417::Lib.encode_text(text)
11
+ end
12
+ end
13
13
 
14
- PDF417_ERROR_SUCCESS = 0
15
- PDF417_ERROR_TEXT_TOO_BIG = 1
16
- PDF417_ERROR_INVALID_PARAMS = 2
17
-
18
- # The int representing the options used to generate the barcode, defined in the library as:
19
- # [PDF417_USE_ASPECT_RATIO] use aspectRatio to set the y/x dimension. Also uses yHeight
20
- # [PDF417_FIXED_RECTANGLE] make the barcode dimensions at least codeColumns by codeRows
21
- # [PDF417_FIXED_COLUMNS] make the barcode dimensions at least codeColumns
22
- # [PDF417_FIXED_ROWS] make the barcode dimensions at least codeRows
23
- # [PDF417_AUTO_ERROR_LEVEL] automatic error level depending on text size
24
- # [PDF417_USE_ERROR_LEVEL] the error level is errorLevel. The used errorLevel may be different
25
- # [PDF417_USE_RAW_CODEWORDS] use codewords instead of text
26
- # [PDF417_INVERT_BITMAP] invert the resulting bitmap
27
- #
28
- # For example
29
- # b.generation_options = PDF417::PDF417_INVERT_BITMAP | PDF417::PDF417_AUTO_ERROR_LEVEL
30
- attr_accessor :generation_options
31
- attr_accessor :text
32
- def inspect # :nodoc:
33
- attributes = inspect_attributes.reject { |x|
34
- begin
35
- attribute = send x
36
- !attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
37
- rescue NoMethodError
38
- true
14
+ attr_reader :bit_columns, :bit_rows, :bit_length
15
+
16
+ def initialize(*attrs)
17
+ # TODO: Test these defaults, make sure that they can get set on init, check to see that the output changes accordingly
18
+ self.text = ""
19
+ @y_height = 3
20
+ @aspect_ratio = 0.5
21
+ @rows = 1
22
+ @cols = 0
23
+
24
+ if attrs.first.is_a?(String)
25
+ self.text = attrs.first
26
+ elsif attrs.first.is_a?(Hash)
27
+ attrs.first.each do |k,v|
28
+ if self.respond_to?("#{k}=".to_sym)
29
+ self.send("#{k}=".to_sym, v)
30
+ end
39
31
  end
40
- }.map { |attribute|
41
- "#{attribute.to_s}=#{send(attribute).inspect}"
42
- }.join ' '
43
- "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
44
- end
32
+ end
33
+
34
+ @blob = nil
35
+ end
36
+
37
+ def inspect
38
+ "#<#{self.class.name}:#{self.object_id} >"
39
+ end
40
+
41
+
42
+ def text=(val)
43
+ @codewords = @blob = nil
44
+ @text = val
45
+ end
45
46
 
46
- private
47
- def inspect_attributes
48
- [:text, :bit_columns, :bit_length, :code_rows, :code_columns, :codeword_length, :error_level, :generation_options, :aspect_ratio, :y_height, :generation_error]
47
+ def text
48
+ if @raw_codewords.nil?
49
+ @text
50
+ else
51
+ ""
52
+ end
53
+ end
54
+
55
+ def codewords
56
+ return @raw_codewords if !@raw_codewords.nil?
57
+ @codewords ||= self.class.encode_text(text)
58
+ end
59
+
60
+ # Y Height
61
+ def y_height
62
+ @y_height
63
+ end
64
+ def y_height=(val)
65
+ @blob = nil
66
+ @y_height = val
67
+ end
68
+
69
+ # Aspect ratio
70
+ def aspect_ratio
71
+ @aspect_ratio
72
+ end
73
+ def aspect_ratio=(val)
74
+ @blob = nil
75
+ @aspect_ratio = val
76
+ end
77
+
78
+ # For setting the codewords directly
79
+ def raw_codewords
80
+ @raw_codewords
81
+ end
82
+ def raw_codewords=(val)
83
+ @blob = nil
84
+ @raw_codewords = val
85
+ end
86
+
87
+ # Make the barcode at least this number of rows
88
+ def rows
89
+ @rows
90
+ end
91
+ def rows=(val)
92
+ @blob = nil
93
+ @rows = val
49
94
  end
95
+
96
+ # Make the barcode at least this number of columns
97
+ def cols
98
+ @cols
99
+ end
100
+ def cols=(val)
101
+ @blob = nil
102
+ @cols = val
103
+ end
104
+
105
+ # Request the specified error level must be between 0 and 8
106
+ def error_level
107
+ @error_level
108
+ end
109
+ def error_level=(val)
110
+ @blob = nil
111
+ @error_level = val
112
+ end
113
+
114
+ def generate!
115
+ lib = Lib.new(text)
116
+ options = []
117
+ # Setting the text via accessor will set the codewords to nil, but if they have
118
+ # been manually set pass them on.
119
+ if @raw_codewords.is_a?(Array)
120
+ lib.raw_codewords = @raw_codewords
121
+ lib.generation_options |= Lib::PDF417_USE_RAW_CODEWORDS
122
+ options << 'raw codewords'
123
+ end
124
+
125
+ if self.rows.to_i > 0 && self.cols.to_i > 0
126
+ lib.code_rows = self.rows.to_i
127
+ lib.code_cols = self.cols.to_i
128
+ lib.generation_options |= Lib::PDF417_FIXED_RECTANGLE
129
+ options << "#{rows}x#{cols}"
130
+ elsif self.rows.to_i > 0
131
+ lib.code_rows = self.rows.to_i
132
+ lib.generation_options |= Lib::PDF417_FIXED_ROWS
133
+ options << "#{rows} rows"
134
+ elsif self.cols.to_i > 0
135
+ lib.code_cols = self.cols.to_i
136
+ lib.generation_options |= Lib::PDF417_FIXED_COLUMNS
137
+ options << "#{cols} cols"
138
+ end
139
+
140
+ if self.error_level.to_i >= 0 && self.error_level.to_i <= 8
141
+ lib.error_level = self.error_level.to_i
142
+ lib.generation_options |= Lib::PDF417_USE_ERROR_LEVEL
143
+ options << "requested #{error_level.to_i} error level"
144
+ end
145
+
146
+ lib.aspect_ratio = self.aspect_ratio.to_f
147
+ lib.y_height = self.y_height.to_f
148
+
149
+ (@blob = lib.to_blob)
150
+ if @blob.nil? || @blob.empty?
151
+ if lib.generation_error == Lib::PDF417_ERROR_TEXT_TOO_BIG
152
+ raise GenerationError, "Text is too big"
153
+ elsif lib.generation_error == Lib::PDF417_ERROR_INVALID_PARAMS
154
+ msg = "Invalid parameters: #{options.join(', ')}"
155
+ if lib.generation_options & Lib::PDF417_USE_RAW_CODEWORDS && lib.raw_codewords.length != lib.raw_codewords.first
156
+ msg +=". The first element of the raw codwords must be the length of the array. Currently it is #{lib.raw_codewords.first}, perhaps it should be #{lib.raw_codewords.length}?"
157
+ end
158
+ raise GenerationError, msg
159
+ else
160
+ raise GenerationError, "Could not generate bitmap error: #{options.join(', ')}"
161
+ end
162
+ else
163
+ @codewords = lib.codewords
164
+ @bit_columns = lib.bit_columns
165
+ @bit_rows = ((lib.bit_columns - 1) / 8) + 1
166
+ @bit_length = lib.bit_length
167
+ @rows = lib.code_rows
168
+ @cols = lib.code_cols
169
+ @error_level = lib.error_level
170
+ @aspect_ratio = lib.aspect_ratio
171
+ @y_height = lib.y_height
172
+ return true
173
+ end
174
+ end
175
+
176
+
177
+ def to_blob
178
+ self.generate! if @blob.nil?
179
+ @blob
180
+ end
181
+ alias_method :blob, :to_blob
182
+
183
+ def encoding
184
+ self.generate! if @blob.nil?
185
+
186
+ # This matches the output from the pdf417 lib sample output.
187
+ enc = self.blob.bytes.to_a.each_slice(self.bit_rows).to_a[0..(self.rows-1)] # sometimes we get more rows than expected, truncate
188
+
189
+ # The length returned here is too long and we have extra data that gets padded w/ zeroes, meaning it doesn't all match.
190
+ # Eg, instead of ending with "111111101000101001" it ends with "1111111010001010010000000".
191
+ return enc.collect do |row_of_bytes|
192
+ row_of_bytes.collect{|x| sprintf("%08b", x)}.join[0..self.bit_columns-1]
193
+ end
194
+ end
195
+
196
+ def encoding_to_s
197
+ self.encoding.each{|x| puts x.gsub("0"," ")}
198
+ end
199
+
200
+ def to_png(opts = {})
201
+ require 'chunky_png' unless defined?(ChunkyPNG)
202
+
203
+ self.generate! if @blob.nil?
204
+ opts[:x_scale] ||= 1
205
+ opts[:y_scale] ||= 3
206
+ opts[:margin] ||= 10
207
+ full_width = (self.bit_columns * opts[:x_scale]) + (opts[:margin] * 2)
208
+ full_height = (self.rows * opts[:y_scale]) + (opts[:margin] * 2)
209
+
210
+ canvas = ChunkyPNG::Image.new(full_width, full_height, ChunkyPNG::Color::WHITE)
211
+
212
+ x, y = opts[:margin], opts[:margin]
213
+ booleans = encoding.map{|l| l.split(//).map{|c| c == '1' } }
214
+ booleans.each do |line|
215
+ line.each do |bar|
216
+ if bar
217
+ x.upto(x+(opts[:x_scale]-1)) do |xx|
218
+ y.upto y+(opts[:y_scale]-1) do |yy|
219
+ canvas[xx,yy] = ChunkyPNG::Color::BLACK
220
+ end
221
+ end
222
+ end
223
+ x += opts[:x_scale]
224
+ end
225
+ y += opts[:y_scale]
226
+ x = opts[:margin]
227
+ end
228
+ canvas.to_datastream.to_s
229
+ end
230
+
231
+
50
232
  end
@@ -0,0 +1,54 @@
1
+ require 'pdf417/pdf417'
2
+
3
+ # A barebones ruby interface to the C library, uses C style constants
4
+ # and mixes in attribute accessors for moving data back and forth
5
+ class PDF417::Lib
6
+
7
+ PDF417_USE_ASPECT_RATIO = 0
8
+ PDF417_FIXED_RECTANGLE = 1
9
+ PDF417_FIXED_COLUMNS = 2
10
+ PDF417_FIXED_ROWS = 4
11
+ PDF417_AUTO_ERROR_LEVEL = 0
12
+ PDF417_USE_ERROR_LEVEL = 16
13
+ PDF417_USE_RAW_CODEWORDS = 64
14
+ PDF417_INVERT_BITMAP = 128
15
+
16
+ PDF417_ERROR_SUCCESS = 0
17
+ PDF417_ERROR_TEXT_TOO_BIG = 1
18
+ PDF417_ERROR_INVALID_PARAMS = 2
19
+
20
+ # The int representing the options used to generate the barcode, defined in the library as:
21
+ # [PDF417_USE_ASPECT_RATIO] use aspectRatio to set the y/x dimension. Also uses yHeight
22
+ # [PDF417_FIXED_RECTANGLE] make the barcode dimensions at least codeColumns by codeRows
23
+ # [PDF417_FIXED_COLUMNS] make the barcode dimensions at least codeColumns
24
+ # [PDF417_FIXED_ROWS] make the barcode dimensions at least codeRows
25
+ # [PDF417_AUTO_ERROR_LEVEL] automatic error level depending on text size
26
+ # [PDF417_USE_ERROR_LEVEL] the error level is errorLevel. The used errorLevel may be different
27
+ # [PDF417_USE_RAW_CODEWORDS] use codewords instead of text
28
+ # [PDF417_INVERT_BITMAP] invert the resulting bitmap
29
+ #
30
+ # For example
31
+ # b.generation_options = PDF417::PDF417_INVERT_BITMAP | PDF417::PDF417_AUTO_ERROR_LEVEL
32
+
33
+ attr_accessor :generation_options, :text, :raw_codewords
34
+ # The following are read from the last generated barcode, but they need a writer because they get set
35
+ attr_writer :code_rows, :code_cols, :error_level, :y_height, :aspect_ratio
36
+ def inspect # :nodoc:
37
+ attributes = inspect_attributes.reject { |x|
38
+ begin
39
+ attribute = send x
40
+ !attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
41
+ rescue NoMethodError
42
+ true
43
+ end
44
+ }.map { |attribute|
45
+ "#{attribute.to_s}=#{send(attribute).inspect}"
46
+ }.join ' '
47
+ "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
48
+ end
49
+
50
+ private
51
+ def inspect_attributes
52
+ [:text, :bit_columns, :bit_length, :code_rows, :code_columns, :codeword_length, :error_level, :generation_options, :aspect_ratio, :y_height, :generation_error]
53
+ end
54
+ end
@@ -1,18 +1,18 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pdf417}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jamesprior"]
12
- s.date = %q{2011-03-30}
12
+ s.date = %q{2011-07-25}
13
13
  s.description = %q{Generate a series of codewords or a binary blob for PDF417 barcodes}
14
14
  s.email = %q{j.prior@asee.org}
15
- s.extensions = ["ext/pdf417/extconf.rb"]
15
+ s.extensions = ["ext/pdf417/extconf.rb", "ext/pdf417/extconf.rb"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
18
18
  "README.rdoc"
@@ -32,17 +32,21 @@ Gem::Specification.new do |s|
32
32
  "ext/pdf417/pdf417lib.h",
33
33
  "ext/pdf417/pdf417libimp.h",
34
34
  "lib/pdf417.rb",
35
+ "lib/pdf417/lib.rb",
35
36
  "pdf417.gemspec",
37
+ "script/console",
38
+ "test/pdf417/lib_test.rb",
36
39
  "test/pdf417_test.rb",
37
40
  "test/test_helper.rb"
38
41
  ]
39
42
  s.homepage = %q{http://github.com/asee/pdf417}
40
43
  s.rdoc_options = ["--charset=UTF-8"]
41
- s.require_paths = ["lib", "ext"]
42
- s.rubygems_version = %q{1.6.2}
44
+ s.require_paths = ["lib", "ext", "ext"]
45
+ s.rubygems_version = %q{1.5.3}
43
46
  s.summary = %q{A Ruby wrapper for the PDF417 barcode library}
44
47
  s.test_files = [
45
- "test/pdf417_test.rb",
48
+ "test/pdf417/lib_test.rb",
49
+ "test/pdf417_test.rb",
46
50
  "test/test_helper.rb"
47
51
  ]
48
52
 
@@ -55,3 +59,4 @@ Gem::Specification.new do |s|
55
59
  else
56
60
  end
57
61
  end
62
+
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
3
+ libs = " -r irb/completion"
4
+ libs << " -I #{File.join(File.dirname(__FILE__), '..', 'lib')}"
5
+ libs << " -I #{File.join(File.dirname(__FILE__), '..', 'ext')}"
6
+ libs << " -I #{File.join(File.dirname(__FILE__), '..', '..', 'barby')}"
7
+ libs << " -r pdf417"
8
+ libs << " -r rubygems"
9
+ #libs << " -r chunky_png"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,55 @@
1
+ require 'test_helper'
2
+
3
+ class PDF417::Lib::LibTest < Test::Unit::TestCase
4
+
5
+ should "initialize text" do
6
+ b = PDF417::Lib.new("fred")
7
+ assert_equal "fred", b.text
8
+ end
9
+
10
+ should "initialize generation_options" do
11
+ b = PDF417::Lib.new("fred")
12
+ assert_equal 0, b.generation_options
13
+ end
14
+
15
+ should "know the right codewords for fred" do
16
+ assert_equal [4, 815, 514, 119], PDF417::Lib.encode_text("fred")
17
+ assert_equal [4, 815, 514, 119], PDF417::Lib.new("fred").codewords
18
+ end
19
+
20
+ should "re-generate if the text has been reassigned" do
21
+ b = PDF417::Lib.new("fred")
22
+ fred_words = b.codewords
23
+ fred_blob = b.to_blob
24
+ b.text = "Joebob"
25
+ assert fred_words != b.codewords
26
+ assert fred_blob != b.to_blob
27
+ end
28
+
29
+ should "re-generate if the text has been updated" do
30
+ b = PDF417::Lib.new("fred")
31
+ fred_words = b.codewords
32
+ fred_blob = b.to_blob
33
+ b.text += " and joe"
34
+ assert fred_words != b.codewords
35
+ assert fred_blob != b.to_blob
36
+ end
37
+
38
+ should "re-generate if the options have changed" do
39
+ b = PDF417::Lib.new("fred")
40
+ fred_words = b.codewords
41
+ fred_blob = b.to_blob
42
+ b.generation_options = PDF417::Lib::PDF417_INVERT_BITMAP
43
+ assert_equal b.generation_options, PDF417::Lib::PDF417_INVERT_BITMAP
44
+ assert_equal fred_words, b.codewords # NOTE that the codewords have not changed, just the binary blob
45
+ assert fred_blob != b.to_blob
46
+ end
47
+
48
+ should "work when generation options are set weird" do
49
+ b = PDF417::Lib.new("fred")
50
+ b.generation_options = "ALBERT"
51
+ assert b.codewords.is_a?(Array)
52
+ end
53
+
54
+
55
+ end
@@ -1,23 +1,28 @@
1
+ begin
2
+ require "RMagick"
3
+ rescue LoadError
4
+ end
5
+
1
6
  require 'test_helper'
2
7
 
3
8
  class Pdf417Test < Test::Unit::TestCase
4
9
 
5
- should "initialize text" do
6
- b = PDF417.new("fred")
10
+ should "initialize text as an attr" do
11
+ b = PDF417.new(:text => "fred")
7
12
  assert_equal "fred", b.text
8
13
  end
9
14
 
10
- should "initialize generation_options" do
15
+ should "initialize text as a single parameter" do
11
16
  b = PDF417.new("fred")
12
- assert_equal 0, b.generation_options
17
+ assert_equal "fred", b.text
13
18
  end
14
-
19
+
15
20
  should "know the right codewords for fred" do
16
21
  assert_equal [4, 815, 514, 119], PDF417.encode_text("fred")
17
- assert_equal [4, 815, 514, 119], PDF417.new("fred").codewords
22
+ assert_equal [4, 815, 514, 119], PDF417.new(:text => "fred").codewords
18
23
  end
19
24
 
20
- should "re-generate if the text has been reassigned" do
25
+ should "re-generate codewords if the text has been reassigned" do
21
26
  b = PDF417.new("fred")
22
27
  fred_words = b.codewords
23
28
  fred_blob = b.to_blob
@@ -39,17 +44,137 @@ class Pdf417Test < Test::Unit::TestCase
39
44
  b = PDF417.new("fred")
40
45
  fred_words = b.codewords
41
46
  fred_blob = b.to_blob
42
- b.generation_options = PDF417::PDF417_INVERT_BITMAP
43
- assert_equal b.generation_options, PDF417::PDF417_INVERT_BITMAP
47
+ b.rows = b.rows + 4
44
48
  assert_equal fred_words, b.codewords # NOTE that the codewords have not changed, just the binary blob
45
49
  assert fred_blob != b.to_blob
46
50
  end
47
51
 
48
- should "work when generation options are set weird" do
49
- b = PDF417.new("fred")
50
- b.generation_options = "ALBERT"
51
- assert b.codewords.is_a?(Array)
52
+ should "set the text to nil when using raw codewords" do
53
+ b = PDF417.new("TEST")
54
+ b.raw_codewords = [4, 815, 514, 119]
55
+ assert_equal "", b.text
56
+ end
57
+
58
+ should "accept raw codewords" do
59
+ b = PDF417.new
60
+ b.raw_codewords = [4, 815, 514, 119]
61
+ assert_equal [4, 815, 514, 119], b.codewords
62
+ assert_nothing_raised do
63
+ b.to_blob
64
+ end
65
+ assert_barcode b
52
66
  end
53
67
 
68
+ context "after generating" do
69
+ setup do
70
+ @barcode = PDF417.new("test")
71
+ @barcode.generate!
72
+ @blob = @barcode.blob
73
+ end
74
+
75
+ should "have a blob" do
76
+ assert_not_nil @barcode.blob
77
+ assert_not_nil @barcode.to_blob
78
+ assert_barcode @barcode
79
+ end
80
+
81
+ should "know bit columns" do
82
+ assert_not_nil @barcode.bit_columns
83
+ end
84
+
85
+ should "know bit rows" do
86
+ assert_not_nil @barcode.bit_rows
87
+ end
88
+
89
+ should "know bit length" do
90
+ assert_not_nil @barcode.bit_length
91
+ end
92
+
93
+ should "know rows" do
94
+ assert_not_nil @barcode.rows
95
+ end
96
+
97
+ should "know cols" do
98
+ assert_not_nil @barcode.cols
99
+ end
100
+
101
+ should "know error level" do
102
+ assert_not_nil @barcode.error_level
103
+ end
104
+
105
+ should "know aspect ratio" do
106
+ assert_not_nil @barcode.aspect_ratio
107
+ end
108
+
109
+ should "know y height" do
110
+ assert_not_nil @barcode.y_height
111
+ end
112
+
113
+ should "regenerate after rows changed" do
114
+ @barcode.rows = 10
115
+ assert_not_equal @blob, @barcode.to_blob
116
+ assert_barcode @barcode
117
+ end
118
+
119
+ should "regenerate after cols changed" do
120
+ @barcode.cols = 10
121
+ assert_not_equal @blob, @barcode.to_blob
122
+ assert_barcode @barcode
123
+ end
124
+
125
+ should "regenerate after error level changed" do
126
+ @barcode.error_level = 7
127
+ assert_not_equal @blob, @barcode.to_blob
128
+ assert_barcode_start_sequence @barcode
129
+ assert_barcode_end_sequence @barcode
130
+ end
131
+
132
+ should "regenerate after raw codewords changed" do
133
+ @barcode.raw_codewords = @barcode.codewords + [245, 123]
134
+ @barcode.raw_codewords[0] = @barcode.raw_codewords.length
135
+ assert_not_equal @blob, @barcode.to_blob
136
+ assert_barcode @barcode
137
+ end
138
+
139
+ should "regenerate after aspect ratio changed" do
140
+ # Aspect ratio does not apply when both rows and cols are set, so re-set our
141
+ # reference and make sure there is enough data to have rows and cols
142
+ @barcode.text = "SOME REALLY LONG TEXT HERE! Gonna need some rows...." * 10
143
+ @barcode.rows = nil
144
+ @barcode.cols = 2
145
+ @barcode.error_level = 3
146
+ @blob = @barcode.to_blob
147
+ @barcode.aspect_ratio = 1000
148
+ assert_not_equal @blob, @barcode.to_blob
149
+ assert_barcode_start_sequence @barcode
150
+ assert_barcode_end_sequence @barcode
151
+ end
152
+ end
153
+
154
+ should "know max rows after generating out of bounds" do
155
+ b = PDF417.new(:rows => 10000, :text => "test")
156
+ b.generate!
157
+ assert_not_equal 10000, b.rows
158
+ end
159
+
160
+
161
+ # if Object.const_defined? "Magick"
162
+ # context "using RMagick" do
163
+ # setup do
164
+ # @barcode = PDF417.new("test text" * 100)
165
+ # @barcode.generate!
166
+ # end
167
+ #
168
+ # should "make an image" do
169
+ # # @barcode.to_blob.split(//).collect{|x| x.unpack("B*")}.to_s.inspect
170
+ # image = Magick::Image::from_blob(@barcode.to_blob).first
171
+ # puts "Width: #{image.columns}; Height: #{image.rows}"
172
+ # end
173
+ # end
174
+ # else
175
+ # puts "*** Skipping rmagick tests"
176
+ # end
177
+
178
+
54
179
 
55
180
  end
@@ -7,7 +7,30 @@ require 'pdf417'
7
7
  require 'rubygems'
8
8
  require 'test/unit'
9
9
  require 'shoulda'
10
+ require 'ruby-debug'
10
11
 
11
12
 
12
13
  class Test::Unit::TestCase
13
14
  end
15
+
16
+ def assert_barcode(barcode, msg = nil)
17
+ full_message = build_message(msg, "? should have a valid PDF417 start and end sequence for each row", barcode)
18
+ assert_block(full_message) do
19
+ barcode.encoding.any? && barcode.encoding.all?{|x| x.start_with?("11111111010101000") && x.end_with?("111111101000101001") }
20
+ end
21
+ end
22
+
23
+ def assert_barcode_start_sequence(barcode, msg = nil)
24
+ full_message = build_message(msg, "? should have a valid PDF417 start sequence for each row", barcode)
25
+ assert_block(full_message) do
26
+ barcode.encoding.any? && barcode.encoding.all?{|x| x.start_with?("11111111010101000")}
27
+ end
28
+ end
29
+
30
+
31
+ def assert_barcode_end_sequence(barcode, msg = nil)
32
+ full_message = build_message(msg, "? should have a valid PDF417 end sequence for each row", barcode)
33
+ assert_block(full_message) do
34
+ barcode.encoding.any? && barcode.encoding.all?{|x| x.end_with?("111111101000101001") }
35
+ end
36
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf417
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - jamesprior
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-30 00:00:00 -04:00
18
+ date: 2011-07-25 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -25,6 +25,7 @@ executables: []
25
25
 
26
26
  extensions:
27
27
  - ext/pdf417/extconf.rb
28
+ - ext/pdf417/extconf.rb
28
29
  extra_rdoc_files:
29
30
  - LICENSE
30
31
  - README.rdoc
@@ -43,7 +44,10 @@ files:
43
44
  - ext/pdf417/pdf417lib.h
44
45
  - ext/pdf417/pdf417libimp.h
45
46
  - lib/pdf417.rb
47
+ - lib/pdf417/lib.rb
46
48
  - pdf417.gemspec
49
+ - script/console
50
+ - test/pdf417/lib_test.rb
47
51
  - test/pdf417_test.rb
48
52
  - test/test_helper.rb
49
53
  has_rdoc: true
@@ -56,6 +60,7 @@ rdoc_options:
56
60
  require_paths:
57
61
  - lib
58
62
  - ext
63
+ - ext
59
64
  required_ruby_version: !ruby/object:Gem::Requirement
60
65
  none: false
61
66
  requirements:
@@ -77,10 +82,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
82
  requirements: []
78
83
 
79
84
  rubyforge_project:
80
- rubygems_version: 1.6.2
85
+ rubygems_version: 1.5.3
81
86
  signing_key:
82
87
  specification_version: 3
83
88
  summary: A Ruby wrapper for the PDF417 barcode library
84
89
  test_files:
90
+ - test/pdf417/lib_test.rb
85
91
  - test/pdf417_test.rb
86
92
  - test/test_helper.rb