Class: DynamicPDFApi::QrCodeElement
- Inherits:
-
Dim2BarcodeElement
- Object
- Element
- BarcodeElement
- Dim2BarcodeElement
- DynamicPDFApi::QrCodeElement
- Defined in:
- lib/ruby_client/Elements/QrCodeElement.rb
Overview
Represents a QR code barcode element.
With some of the .Net runtime (example: .Net Core 2.0), the Kanchi encoding will give the error ‘No data is available for encoding 932. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.’.
Instance Attribute Summary collapse
-
#_type ⇒ Object
Returns the value of attribute _type.
-
#fnc1 ⇒ Object
Gets or sets FNC1 mode.
-
#version ⇒ Object
Gets or sets the QR code version.
Attributes inherited from Dim2BarcodeElement
Attributes inherited from BarcodeElement
#_color_name, #value, #x_dimension
Attributes inherited from Element
#_input_value, #_resource, #_text_font, #even_pages, #odd_pages, #placement, #x_offset, #y_offset
Instance Method Summary collapse
-
#initialize(value, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0) ⇒ QrCodeElement
constructor
Initializes a new instance of the QrCodeElement class.
- #to_json(_options = {}) ⇒ Object
Methods inherited from BarcodeElement
Constructor Details
#initialize(value, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0) ⇒ QrCodeElement
Initializes a new instance of the QrCodeElement class.
22 23 24 25 |
# File 'lib/ruby_client/Elements/QrCodeElement.rb', line 22 def initialize(value, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0) super(value, placement, x_offset, y_offset) @_type = ElementType::QR_CODE end |
Instance Attribute Details
#_type ⇒ Object
Returns the value of attribute _type.
27 28 29 |
# File 'lib/ruby_client/Elements/QrCodeElement.rb', line 27 def _type @_type end |
#fnc1 ⇒ Object
Gets or sets FNC1 mode.
32 33 34 |
# File 'lib/ruby_client/Elements/QrCodeElement.rb', line 32 def fnc1 @fnc1 end |
#version ⇒ Object
Gets or sets the QR code version.
37 38 39 |
# File 'lib/ruby_client/Elements/QrCodeElement.rb', line 37 def version @version end |
Instance Method Details
#to_json(_options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ruby_client/Elements/QrCodeElement.rb', line 39 def to_json( = {}) json_array = {} json_array['type'] = 'qrCode' json_array['fnc1'] = @fnc1 unless @fnc1.nil? json_array['version'] = @version unless @version.nil? #--------------Dim2BarcodeElement------------------------------ json_array['valueType'] = @_value_type unless @_value_type.nil? #----------------barcodeElement-------------------------------- json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil? json_array['xDimension'] = @x_dimension unless @x_dimension.nil? json_array['value'] = @value unless @value.nil? # ------------element--------------------- json_array['placement'] = @placement unless @placement.nil? json_array['xOffset'] = @x_offset unless @x_offset.nil? json_array['yOffset'] = @y_offset unless @y_offset.nil? json_array["evenPages"] = @even_pages unless @even_pages.nil? json_array["oddPages"] = @odd_pages unless @odd_pages.nil? JSON.pretty_generate(json_array) end |