prawn-qrcode 0.2.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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/core'
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::new(:page_size => "A4") do
22
-
23
- text "Sample autosized QR-Code (with stroked bounds) Size of QRCode : 1 in (72 pt)"
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 "Sample autosized QR-Code (with and without stroked bounds) Size of QRCode : 2 in (144 pt)"
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, :extent=>144)
30
- print_qr_code(qrcode, :pos=>[150,cpos], :extent=>144, :stroke=>false)
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 "Sample autosized QR-Code (with stroked bounds) Size of QRCode :10 cm"
34
- print_qr_code(qrcode, :extent=>10.send(:cm), :stroke=>true, :level=>:q)
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("autosized.pdf")
38
- end
35
+ text "Quite huge, isn't it?"
36
+ render_file('autosize.pdf')
37
+ end
Binary file
@@ -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/core'
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::new(:page_size => "A4") do
22
- text "Sample autosized QR-Code (with stroked bounds). Size of dots : 3mm (huge)"
23
- print_qr_code(qrcode, :dot=>3.send(:mm))
24
- move_down 20
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
- print_qr_code(qrcode, :dot=>1.send(:mm))
29
- print_qr_code(qrcode, :pos=>[150,cpos], :dot=>1.send(:mm), :stroke=>false)
30
- move_down 20
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
- text "Higher ECC Levels (may) increase module size. "+
33
- "This QR Code uses ECC Level Q (ca. 30% of symbols can be recovered)."
34
- print_qr_code(qrcode, :dot=>1.send(:mm), :level=>:q)
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
- render_file("dotsize.pdf")
37
- end
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