Class: Prawn::SwissQRBill::Sections::QRCode
- Defined in:
- lib/prawn/swiss_qr_bill/sections/qr_code.rb
Overview
QR code section
The swiss cross is applied directly on the QR PNG. The PNG needs to be resized down, that the swiss cross overlaps exactly 9x9 modules for a QR-code of compression level :m.
swiss_cross.png => 166px ~> 7.mm QR-code: 1090px <~ 46.mm
Constant Summary collapse
- KEY =
'payment.qr_code'
- QR_PX_SIZE =
1160
- SWISS_CROSS_FILE =
File.("#{__dir__}/../../../../assets/images/swiss_cross.png")
- MAPPING =
{ creditor_address_type: %i[creditor address type], creditor_address_name: %i[creditor address name], creditor_address_line1: %i[creditor address line1], creditor_address_line2: %i[creditor address line2], creditor_address_postal_code: %i[creditor address postal_code], creditor_address_city: %i[creditor address city], creditor_address_country: %i[creditor address country], debtor_address_type: %i[debtor address type], debtor_address_name: %i[debtor address name], debtor_address_line1: %i[debtor address line1], debtor_address_line2: %i[debtor address line2], debtor_address_postal_code: %i[debtor address postal_code], debtor_address_city: %i[debtor address city], debtor_address_country: %i[debtor address country], amount: [:amount], currency: [:currency], reference: [:reference], reference_type: [:reference_type], unstructured_message: [:unstructured_message], bill_information: [:bill_information] }.freeze
Instance Attribute Summary
Attributes inherited from Section
Instance Method Summary collapse
Methods inherited from Section
Constructor Details
This class inherits a constructor from Prawn::SwissQRBill::Sections::Section
Instance Method Details
#draw ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/prawn/swiss_qr_bill/sections/qr_code.rb', line 44 def draw png = qr_as_png(@data) add_swiss_cross!(png) io = StringIO.new(png.to_blob) box do doc.image io, width: specs.width end end |