class BrDanfe::QrCode
Public Class Methods
Source
# File lib/br_danfe/qr_code.rb, line 7 def initialize(pdf:, qr_code_tag:, box_size:) @pdf = pdf @qr_code_tag = qr_code_tag @box_size = box_size end
Public Instance Methods
Source
# File lib/br_danfe/qr_code.rb, line 13 def render qrcode = RQRCode::QRCode.new(@qr_code_tag) image = Tempfile.new(%w[qrcode png], binmode: true) image.write(qrcode.as_png(module_px_size: 12).to_s) @pdf.image(image, width: @box_size, height: @box_size, position: :center) end