Method: Corpshort::HorizontalPdf#render

Defined in:
lib/corpshort/horizontal_pdf.rb

#renderObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/corpshort/horizontal_pdf.rb', line 68

def render
  @pdf = nil

  pdf.fill_color 'FFFFFF'
  pdf.fill { pdf.rounded_rectangle [0, code_size], code_size, code_size, 10 }
  pdf.print_qr_code(@url, level: :m, extent: code_size, stroke: false)

  [true, false].each do |dry_run|
    box = url_box()
    box.render(dry_run: dry_run)
    if dry_run
      pdf.fill_color 'FFFFFF'
      pdf.fill do
        pdf.rounded_rectangle(
          [box.at[0] - padding, box.at[1] + padding],
          box.available_width + padding + padding,
          box.height + padding + padding,
          5,
        )
      end
      pdf.fill_color '000000'
    end
  end

  pdf
end