prawn-qrcode 0.2.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/examples/autosize.pdf +5647 -0
- data/examples/autosize_qrcode.rb +12 -13
- data/examples/dotsize.pdf +0 -0
- data/examples/dotsize_qrcode.rb +38 -15
- data/examples/prepared.pdf +4273 -0
- data/examples/prepared_qrcode.rb +7 -7
- data/lib/prawn/qrcode/version.rb +5 -0
- data/lib/prawn/qrcode.rb +84 -94
- data/prawn-qrcode.gemspec +14 -6
- metadata +41 -9
data/examples/autosize_qrcode.rb
CHANGED
@@ -12,27 +12,26 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
require 'rubygems'
|
15
|
-
require 'prawn
|
15
|
+
require 'prawn'
|
16
16
|
require 'prawn/measurement_extensions'
|
17
17
|
require_relative '../lib/prawn/qrcode'
|
18
18
|
|
19
19
|
qrcode = 'https://github.com/jabbrwcky/prawn-qrcode'
|
20
20
|
|
21
|
-
Prawn::Document
|
22
|
-
|
23
|
-
|
24
|
-
print_qr_code(qrcode, :extent=>72)
|
21
|
+
Prawn::Document.new(page_size: 'A4') do
|
22
|
+
text 'Sample autosized QR-Code (with stroked bounds) Size of QRCode : 1 in (72 pt)'
|
23
|
+
print_qr_code(qrcode, extent: 72)
|
25
24
|
move_down 20
|
26
25
|
|
27
|
-
text
|
26
|
+
text 'Sample autosized QR-Code (with and without stroked bounds) Size of QRCode : 2 in (144 pt)'
|
28
27
|
cpos = cursor
|
29
|
-
print_qr_code(qrcode, :
|
30
|
-
print_qr_code(qrcode, :
|
28
|
+
print_qr_code(qrcode, extent: 144)
|
29
|
+
print_qr_code(qrcode, pos: [150, cpos], extent: 144, stroke: false)
|
31
30
|
move_down 10
|
32
31
|
|
33
|
-
text
|
34
|
-
print_qr_code(qrcode, :
|
32
|
+
text 'Sample autosized QR-Code (with stroked bounds) Size of QRCode :10 cm'
|
33
|
+
print_qr_code(qrcode, extent: 10.send(:cm), stroke: true, level: :q)
|
35
34
|
move_down 10
|
36
|
-
text "Quite huge, isn't it?
|
37
|
-
render_file(
|
38
|
-
end
|
35
|
+
text "Quite huge, isn't it?"
|
36
|
+
render_file('autosize.pdf')
|
37
|
+
end
|
Binary file
|
data/examples/dotsize_qrcode.rb
CHANGED
@@ -12,26 +12,49 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
require 'rubygems'
|
15
|
-
require 'prawn
|
15
|
+
require 'prawn'
|
16
16
|
require 'prawn/measurement_extensions'
|
17
17
|
require_relative '../lib/prawn/qrcode'
|
18
18
|
|
19
19
|
qrcode = 'https://github.com/jabbrwcky/prawn-qrcode'
|
20
20
|
|
21
|
-
Prawn::Document
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
text "Sample QR-Code (with and without stroked bounds) using dots with size: 1 mm (~2.8pt)"
|
21
|
+
Prawn::Document.new(page_size: 'A4') do
|
22
|
+
font 'Helvetica', style: :bold do
|
23
|
+
text 'Sample autosized QR-Code (with stroked bounds). Size of dots : 3mm (huge)'
|
24
|
+
end
|
25
|
+
move_down 5.mm
|
27
26
|
cpos = cursor
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
font 'Courier', size: 8 do
|
28
|
+
text_box "require 'prawn/measurement_extensions'\n\nprint_qr_code(qrcode, dot: 3.mm)", at: [320, cursor], height: 200, width: 220
|
29
|
+
end
|
30
|
+
print_qr_code(qrcode, dot: 3.mm)
|
31
|
+
move_down 30
|
32
|
+
|
33
|
+
font 'Helvetica', style: :bold do
|
34
|
+
text 'Sample QR-Code (with and without stroked bounds) using dots with size: 1 mm (~2.8pt)'
|
35
|
+
end
|
31
36
|
|
32
|
-
|
33
|
-
|
34
|
-
print_qr_code(qrcode, :
|
37
|
+
move_down 10
|
38
|
+
cpos = cursor
|
39
|
+
print_qr_code(qrcode, dot: 1.mm)
|
40
|
+
print_qr_code(qrcode, pos: [150, cpos], dot: 1.mm, stroke: false)
|
41
|
+
font 'Courier', size: 8 do
|
42
|
+
text_box "require 'prawn/measurement_extensions'\n\n" +
|
43
|
+
"print_qr_code(qrcode, dot: 1.mm)\n"+
|
44
|
+
"print_qr_code(qrcode, pos: [150,cpos], dot: 1.mm, stroke: false)", at: [320, cpos], height: 200, width: 220
|
45
|
+
end
|
35
46
|
|
36
|
-
|
37
|
-
|
47
|
+
move_down 30
|
48
|
+
font 'Helvetica', style: :bold do
|
49
|
+
text 'Higher ECC Levels (may) increase module size. '\
|
50
|
+
'This QR Code uses ECC Level Q (ca. 30% of symbols can be recovered).'
|
51
|
+
end
|
52
|
+
move_down 10
|
53
|
+
cpos = cursor
|
54
|
+
print_qr_code(qrcode, dot: 1.mm, level: :q)
|
55
|
+
font 'Courier', size: 8 do
|
56
|
+
text_box "require 'prawn/measurement_extensions'\n\n" +
|
57
|
+
"print_qr_code(qrcode, dot: 1.mm, level: :q)", at: [320, cpos], height: 200, width: 220
|
58
|
+
end
|
59
|
+
render_file('dotsize.pdf')
|
60
|
+
end
|