barcoder 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +79 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/init.rb +4 -0
- data/lib/barcoder.rb +91 -0
- data/rdoc/classes/ActionView.html +129 -0
- data/rdoc/classes/ActionView/Base.html +338 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README.html +233 -0
- data/rdoc/files/lib/barcoder_rb.html +119 -0
- data/rdoc/fr_class_index.html +28 -0
- data/rdoc/fr_file_index.html +28 -0
- data/rdoc/fr_method_index.html +31 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- metadata +84 -0
data/rdoc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Mon, 23 Nov 2009 00:22:15 -0800
|
@@ -0,0 +1,233 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Mon Nov 23 00:20:30 -0800 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
Barcoder, v 1.0
|
74
|
+
</p>
|
75
|
+
<h6>=========</h6>
|
76
|
+
<p>
|
77
|
+
### Author : Derek Perez
|
78
|
+
</p>
|
79
|
+
<p>
|
80
|
+
inspired (heavily) by the work of Author: Anuj Luthra. He originally wrote
|
81
|
+
the library barcode_generator (<a
|
82
|
+
href="http://github.com/anujluthra/barcode-generator">github.com/anujluthra/barcode-generator</a>/),
|
83
|
+
that this library is based on.
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
This library is designed to support streaming barcode information, from
|
87
|
+
GBarcode, straight to the web browser using data urls (<a
|
88
|
+
href="http://en.wikipedia.org/wiki/Data_URI_scheme">en.wikipedia.org/wiki/Data_URI_scheme</a>).
|
89
|
+
This is ideal for no-write filesystem scenarios. It also supports
|
90
|
+
persisting the barcodes to disk, but this is an optional function. By
|
91
|
+
default, data urls are used. Barcode generator makes generating/displaying
|
92
|
+
barcodes for certain alphanumeric ids a piece of cake. This way we can
|
93
|
+
generate any barcode type which Gbarcode -> Gnome Barcode project
|
94
|
+
supports.
|
95
|
+
</p>
|
96
|
+
<p>
|
97
|
+
### FAQ
|
98
|
+
</p>
|
99
|
+
<p>
|
100
|
+
#### Why did you create this plugin?
|
101
|
+
</p>
|
102
|
+
<p>
|
103
|
+
barcode_generator is an awesome plugin, however, it does not interact very
|
104
|
+
well with non-write filesystem style servers, ie: Heroku, or EC2. In the
|
105
|
+
cloud, you can‘t be writing files to the filesystem (usually)
|
106
|
+
directly, so I thought it was necessary to write a plugin that could use
|
107
|
+
data urls (<a
|
108
|
+
href="http://en.wikipedia.org/wiki/Data_URI_scheme">en.wikipedia.org/wiki/Data_URI_scheme</a>)
|
109
|
+
to stream the barcode to the browser, __with no filesystem writes
|
110
|
+
whatsoever.__
|
111
|
+
</p>
|
112
|
+
<p>
|
113
|
+
#### Why didn‘t you just fork his plugin?
|
114
|
+
</p>
|
115
|
+
<p>
|
116
|
+
Anuj appeared to not want to rely directly on the RMagick gem itself.
|
117
|
+
Instead, he was calling imagemagick‘s configure command via
|
118
|
+
Kernel#system. There is nothing wrong with this, but I did not want to add
|
119
|
+
back this dependency if he didn‘t need/want it. Also, I substantially
|
120
|
+
re-wrote how the plugin generates the barcode with gbarcode.
|
121
|
+
</p>
|
122
|
+
<p>
|
123
|
+
#### Is your API compatible with barcode_generator?
|
124
|
+
</p>
|
125
|
+
<p>
|
126
|
+
Yes, it should work identically.
|
127
|
+
</p>
|
128
|
+
<p>
|
129
|
+
### USAGE: its as simple as saying: `<%= to_barcode ‘FJJ4JD’
|
130
|
+
%> `
|
131
|
+
</p>
|
132
|
+
<p>
|
133
|
+
This will generate a barcode for FJJ4JD in BARCODE_39 format with default
|
134
|
+
width and height and include it in the view.
|
135
|
+
</p>
|
136
|
+
<p>
|
137
|
+
### Options Options Options: To customize your barcodes, you can optionally
|
138
|
+
pass following information in your views
|
139
|
+
</p>
|
140
|
+
<pre>
|
141
|
+
+ encoding_format (Gbarcode constants for eg. Gbarcode::BARCODE_128 etc..)
|
142
|
+
+ width
|
143
|
+
+ height
|
144
|
+
+ scaling_factor
|
145
|
+
+ xoff
|
146
|
+
+ yoff
|
147
|
+
+ margin
|
148
|
+
+ no_ascii (accepts boolean true or false, prevents the ascii string from printing at the bottom of the barcode)
|
149
|
+
+ output_type (accepts :disk or :stream. :disk will print the image to disk, and serve it regularly.)
|
150
|
+
</pre>
|
151
|
+
<p>
|
152
|
+
in this case your view will look like:
|
153
|
+
</p>
|
154
|
+
<pre>
|
155
|
+
<%= to_barcode 'ANUJ', :height => 100,
|
156
|
+
:width => 400,
|
157
|
+
:margin => 100,
|
158
|
+
:xoff => 20,
|
159
|
+
:yoff => 40
|
160
|
+
%>
|
161
|
+
</pre>
|
162
|
+
<p>
|
163
|
+
### Installation: First install these requirements:
|
164
|
+
</p>
|
165
|
+
<pre>
|
166
|
+
1. gem for gbarcode
|
167
|
+
2. install native ImageMagick library (and RMagick)
|
168
|
+
</pre>
|
169
|
+
<p>
|
170
|
+
Next, install Barcoder:
|
171
|
+
</p>
|
172
|
+
<p>
|
173
|
+
`install from git : git://github.com/perezd/barcoder.git`
|
174
|
+
</p>
|
175
|
+
<p>
|
176
|
+
### Supported Barcode Formats: Gbarcode as of now allows us to generate
|
177
|
+
barcodes in following formats:
|
178
|
+
</p>
|
179
|
+
<pre>
|
180
|
+
BARCODE_EAN
|
181
|
+
BARCODE_UPC
|
182
|
+
BARCODE_ISBN
|
183
|
+
BARCODE_128B
|
184
|
+
BARCODE_128C
|
185
|
+
BARCODE_128
|
186
|
+
BARCODE_128RAW
|
187
|
+
BARCODE_39
|
188
|
+
BARCODE_I25
|
189
|
+
BARCODE_CBR
|
190
|
+
BARCODE_MSI
|
191
|
+
BARCODE_PLS
|
192
|
+
BARCODE_93
|
193
|
+
BARCODE_ANY
|
194
|
+
BARCODE_NO_CHECKSUM
|
195
|
+
</pre>
|
196
|
+
<p>
|
197
|
+
for more information on Gbarcode visit <a
|
198
|
+
href="http://gbarcode.rubyforge.org/rdoc/index.html">gbarcode.rubyforge.org/rdoc/index.html</a>
|
199
|
+
Many many thanks to Anuj Luthra for solving the initial hard work!
|
200
|
+
</p>
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
</div>
|
206
|
+
|
207
|
+
|
208
|
+
</div>
|
209
|
+
|
210
|
+
|
211
|
+
<!-- if includes -->
|
212
|
+
|
213
|
+
<div id="section">
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<!-- if method_list -->
|
223
|
+
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
|
228
|
+
<div id="validator-badges">
|
229
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</body>
|
233
|
+
</html>
|
@@ -0,0 +1,119 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: barcoder.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>barcoder.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/barcoder.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Mon Nov 23 00:19:25 -0800 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
Barcoder, v.1.0 written by: Derek Perez (derek@derekperez.com) 2009
|
74
|
+
inspired (heavily) by the work of Author: Anuj Luthra. He originally wrote
|
75
|
+
the library barcode_generator (<a
|
76
|
+
href="http://github.com/anujluthra/barcode-generator">github.com/anujluthra/barcode-generator</a>/),
|
77
|
+
that this library is based on.
|
78
|
+
</p>
|
79
|
+
<p>
|
80
|
+
This library is designed to support streaming barcode information, from
|
81
|
+
GBarcode, straight to the web browser using data urls (<a
|
82
|
+
href="http://en.wikipedia.org/wiki/Data_URI_scheme">en.wikipedia.org/wiki/Data_URI_scheme</a>).
|
83
|
+
This is ideal for no-write filesystem scenarios. It also supports
|
84
|
+
persisting the barcodes to disk, but this is an optional function. By
|
85
|
+
default, data urls are used.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<div id="validator-badges">
|
115
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</body>
|
119
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/ActionView.html">ActionView</a><br />
|
24
|
+
<a href="classes/ActionView/Base.html">ActionView::Base</a><br />
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Files
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Files</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Files</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="files/README.html">README</a><br />
|
24
|
+
<a href="files/lib/barcoder_rb.html">lib/barcoder.rb</a><br />
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/ActionView/Base.html#M000002">barcode (ActionView::Base)</a><br />
|
24
|
+
<a href="classes/ActionView/Base.html#M000003">barcode_to_disk (ActionView::Base)</a><br />
|
25
|
+
<a href="classes/ActionView/Base.html#M000004">barcode_to_stream (ActionView::Base)</a><br />
|
26
|
+
<a href="classes/ActionView/Base.html#M000005">get_bytes_from_barcode (ActionView::Base)</a><br />
|
27
|
+
<a href="classes/ActionView/Base.html#M000001">to_barcode (ActionView::Base)</a><br />
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</body>
|
31
|
+
</html>
|
data/rdoc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
Barcoder
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>Barcoder</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/README.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|