pdf417 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +15 -0
- data/LICENSE +20 -0
- data/README.rdoc +46 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/ext/pdf417/Makefile +157 -0
- data/ext/pdf417/extconf.rb +4 -0
- data/ext/pdf417/pdf417.c +291 -0
- data/ext/pdf417/pdf417.h +27 -0
- data/ext/pdf417/pdf417lib.c +860 -0
- data/ext/pdf417/pdf417lib.h +91 -0
- data/ext/pdf417/pdf417libimp.h +514 -0
- data/ext/pdf417/test.rb +52 -0
- data/lib/pdf417.rb +24 -0
- data/test/pdf417_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +74 -0
data/ext/pdf417/test.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Basic testing file, run via make clean && ruby extconf.rb && make && ruby test.rb
|
2
|
+
require 'pdf417'
|
3
|
+
|
4
|
+
class PDF417
|
5
|
+
attr_accessor :text
|
6
|
+
def inspect # :nodoc:
|
7
|
+
attributes = inspect_attributes.reject { |x|
|
8
|
+
begin
|
9
|
+
attribute = send x
|
10
|
+
!attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
|
11
|
+
rescue NoMethodError
|
12
|
+
true
|
13
|
+
end
|
14
|
+
}.map { |attribute|
|
15
|
+
"#{attribute.to_s}=#{send(attribute).inspect}"
|
16
|
+
}.join ' '
|
17
|
+
"#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
private
|
22
|
+
def inspect_attributes
|
23
|
+
[:text, :bit_columns, :bit_length, :code_rows, :code_columns, :codeword_length, :error_level, :generation_options, :aspect_ratio, :y_height, :generation_error]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
puts "Testing codewords for 'fred'"
|
29
|
+
PDF417.encode_text("fred").each_with_index{|cw,i| puts "Ruby thinks cw #{i} is #{cw}"}
|
30
|
+
# For fred, should return:
|
31
|
+
# Ruby thinks cw 0 is 4
|
32
|
+
# Ruby thinks cw 1 is 815
|
33
|
+
# Ruby thinks cw 2 is 514
|
34
|
+
# Ruby thinks cw 3 is 119
|
35
|
+
|
36
|
+
p = PDF417.new("test")
|
37
|
+
puts p.inspect
|
38
|
+
p = PDF417.new("fred")
|
39
|
+
puts p.text
|
40
|
+
puts p.codewords.inspect
|
41
|
+
puts p.to_blob.inspect
|
42
|
+
puts p.bit_columns
|
43
|
+
puts p.bit_length
|
44
|
+
puts p.code_rows
|
45
|
+
puts p.code_columns
|
46
|
+
puts p.codeword_length
|
47
|
+
puts p.error_level
|
48
|
+
puts p.generation_options
|
49
|
+
puts p.aspect_ratio
|
50
|
+
puts p.y_height
|
51
|
+
puts p.generation_error
|
52
|
+
puts p.inspect
|
data/lib/pdf417.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'pdf417/pdf417'
|
2
|
+
|
3
|
+
class PDF417
|
4
|
+
attr_accessor :text
|
5
|
+
def inspect # :nodoc:
|
6
|
+
attributes = inspect_attributes.reject { |x|
|
7
|
+
begin
|
8
|
+
attribute = send x
|
9
|
+
!attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
|
10
|
+
rescue NoMethodError
|
11
|
+
true
|
12
|
+
end
|
13
|
+
}.map { |attribute|
|
14
|
+
"#{attribute.to_s}=#{send(attribute).inspect}"
|
15
|
+
}.join ' '
|
16
|
+
"#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
private
|
21
|
+
def inspect_attributes
|
22
|
+
[:text, :bit_columns, :bit_length, :code_rows, :code_columns, :codeword_length, :error_level, :generation_options, :aspect_ratio, :y_height, :generation_error]
|
23
|
+
end
|
24
|
+
end
|
data/test/pdf417_test.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pdf417
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jamesprior
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2011-03-29 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Generate a series of codewords or a binary blob for PDF417 barcodes
|
17
|
+
email: j.prior@asee.org
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions:
|
21
|
+
- ext/pdf417/extconf.rb
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
32
|
+
- ext/pdf417/Makefile
|
33
|
+
- ext/pdf417/extconf.rb
|
34
|
+
- ext/pdf417/pdf417.c
|
35
|
+
- ext/pdf417/pdf417.h
|
36
|
+
- ext/pdf417/pdf417lib.c
|
37
|
+
- ext/pdf417/pdf417lib.h
|
38
|
+
- ext/pdf417/pdf417libimp.h
|
39
|
+
- ext/pdf417/test.rb
|
40
|
+
- lib/pdf417.rb
|
41
|
+
- test/pdf417_test.rb
|
42
|
+
- test/test_helper.rb
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: http://github.com/asee/pdf417
|
45
|
+
licenses: []
|
46
|
+
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options:
|
49
|
+
- --charset=UTF-8
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
- ext
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.3.5
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: A Ruby wrapper for the PDF417 barcode library
|
72
|
+
test_files:
|
73
|
+
- test/pdf417_test.rb
|
74
|
+
- test/test_helper.rb
|