dynamicpdf_api 1.0.0.pre.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ruby_client/Action.rb +15 -0
  3. data/lib/ruby_client/AdditionalResource.rb +113 -0
  4. data/lib/ruby_client/AdditionalResourceType.rb +27 -0
  5. data/lib/ruby_client/Aes128Security.rb +70 -0
  6. data/lib/ruby_client/Aes256Security.rb +70 -0
  7. data/lib/ruby_client/Align.rb +21 -0
  8. data/lib/ruby_client/ButtonFieldInformation.rb +48 -0
  9. data/lib/ruby_client/ButtonFieldType.rb +16 -0
  10. data/lib/ruby_client/ChoiceFieldInformation.rb +52 -0
  11. data/lib/ruby_client/ChoiceFieldType.rb +16 -0
  12. data/lib/ruby_client/CmykColor.rb +47 -0
  13. data/lib/ruby_client/Color.rb +12 -0
  14. data/lib/ruby_client/ColorSpaceType.rb +36 -0
  15. data/lib/ruby_client/ConverterInput.rb +100 -0
  16. data/lib/ruby_client/DlexInput.rb +61 -0
  17. data/lib/ruby_client/DlexLayout.rb +135 -0
  18. data/lib/ruby_client/DlexResource.rb +40 -0
  19. data/lib/ruby_client/Elements/AztecBarcodeElement.rb +113 -0
  20. data/lib/ruby_client/Elements/AztecSymbolSize.rb +206 -0
  21. data/lib/ruby_client/Elements/BarcodeElement.rb +37 -0
  22. data/lib/ruby_client/Elements/Code11BarcodeElement.rb +77 -0
  23. data/lib/ruby_client/Elements/Code128BarcodeElement.rb +105 -0
  24. data/lib/ruby_client/Elements/Code25BarcodeElement.rb +75 -0
  25. data/lib/ruby_client/Elements/Code39BarcodeElement.rb +75 -0
  26. data/lib/ruby_client/Elements/Code93BarcodeElement.rb +75 -0
  27. data/lib/ruby_client/Elements/Compaction.rb +26 -0
  28. data/lib/ruby_client/Elements/DataMatrixBarcodeElement.rb +95 -0
  29. data/lib/ruby_client/Elements/DataMatrixEncodingType.rb +56 -0
  30. data/lib/ruby_client/Elements/DataMatrixFunctionCharacter.rb +31 -0
  31. data/lib/ruby_client/Elements/DataMatrixSymbolSize.rb +161 -0
  32. data/lib/ruby_client/Elements/Dim2BarcodeElement.rb +28 -0
  33. data/lib/ruby_client/Elements/Element.rb +46 -0
  34. data/lib/ruby_client/Elements/ElementPlacement.rb +36 -0
  35. data/lib/ruby_client/Elements/ElementType.rb +96 -0
  36. data/lib/ruby_client/Elements/ErrorCorrection.rb +56 -0
  37. data/lib/ruby_client/Elements/Gs1DataBarBarcodeElement.rb +76 -0
  38. data/lib/ruby_client/Elements/Gs1DataBarType.rb +22 -0
  39. data/lib/ruby_client/Elements/Iata25BarcodeElement.rb +83 -0
  40. data/lib/ruby_client/Elements/ImageElement.rb +108 -0
  41. data/lib/ruby_client/Elements/LineElement.rb +92 -0
  42. data/lib/ruby_client/Elements/MsiBarcodeCheckDigitMode.rb +31 -0
  43. data/lib/ruby_client/Elements/MsiBarcodeElement.rb +79 -0
  44. data/lib/ruby_client/Elements/PageNumberingElement.rb +91 -0
  45. data/lib/ruby_client/Elements/Pdf417BarcodeElement.rb +112 -0
  46. data/lib/ruby_client/Elements/QrCodeElement.rb +77 -0
  47. data/lib/ruby_client/Elements/QrCodeFnc1.rb +22 -0
  48. data/lib/ruby_client/Elements/RectangleElement.rb +109 -0
  49. data/lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb +90 -0
  50. data/lib/ruby_client/Elements/StackedGs1DataBarType.rb +23 -0
  51. data/lib/ruby_client/Elements/TextBarcodeElement.rb +48 -0
  52. data/lib/ruby_client/Elements/TextElement.rb +83 -0
  53. data/lib/ruby_client/Elements/ValueType.rb +16 -0
  54. data/lib/ruby_client/EncryptDocumentComponents.rb +16 -0
  55. data/lib/ruby_client/EndPointException.rb +7 -0
  56. data/lib/ruby_client/Endpoint.rb +38 -0
  57. data/lib/ruby_client/EndpointResource.rb +7 -0
  58. data/lib/ruby_client/ExcelInput.rb +49 -0
  59. data/lib/ruby_client/ExcelResource.rb +79 -0
  60. data/lib/ruby_client/Font.rb +276 -0
  61. data/lib/ruby_client/FontInformation.rb +9 -0
  62. data/lib/ruby_client/FontResource.rb +35 -0
  63. data/lib/ruby_client/FormField.rb +62 -0
  64. data/lib/ruby_client/FormFieldInformation.rb +45 -0
  65. data/lib/ruby_client/GoToAction.rb +53 -0
  66. data/lib/ruby_client/Grayscale.rb +41 -0
  67. data/lib/ruby_client/HtmlInput.rb +60 -0
  68. data/lib/ruby_client/HtmlResource.rb +34 -0
  69. data/lib/ruby_client/ImageInfo.rb +69 -0
  70. data/lib/ruby_client/ImageInformation.rb +57 -0
  71. data/lib/ruby_client/ImageInput.rb +150 -0
  72. data/lib/ruby_client/ImageResource.rb +89 -0
  73. data/lib/ruby_client/ImageResponse.rb +24 -0
  74. data/lib/ruby_client/Input.rb +53 -0
  75. data/lib/ruby_client/InputType.rb +41 -0
  76. data/lib/ruby_client/JsonResponse.rb +18 -0
  77. data/lib/ruby_client/LayoutDataResource.rb +48 -0
  78. data/lib/ruby_client/LineStyle.rb +79 -0
  79. data/lib/ruby_client/MergeOptions.rb +135 -0
  80. data/lib/ruby_client/MultiSelectListBoxInformation.rb +45 -0
  81. data/lib/ruby_client/Outline.rb +113 -0
  82. data/lib/ruby_client/OutlineList.rb +57 -0
  83. data/lib/ruby_client/OutlineStyle.rb +28 -0
  84. data/lib/ruby_client/OutputSize.rb +10 -0
  85. data/lib/ruby_client/PageInformation.rb +27 -0
  86. data/lib/ruby_client/PageInput.rb +152 -0
  87. data/lib/ruby_client/PageOrientation.rb +17 -0
  88. data/lib/ruby_client/PageSize.rb +127 -0
  89. data/lib/ruby_client/PageZoom.rb +33 -0
  90. data/lib/ruby_client/Pdf.rb +417 -0
  91. data/lib/ruby_client/PdfContent.rb +21 -0
  92. data/lib/ruby_client/PdfInfo.rb +68 -0
  93. data/lib/ruby_client/PdfInfoResponse.rb +27 -0
  94. data/lib/ruby_client/PdfInformation.rb +81 -0
  95. data/lib/ruby_client/PdfInput.rb +66 -0
  96. data/lib/ruby_client/PdfInstructions.rb +97 -0
  97. data/lib/ruby_client/PdfResource.rb +36 -0
  98. data/lib/ruby_client/PdfResponse.rb +23 -0
  99. data/lib/ruby_client/PdfText.rb +85 -0
  100. data/lib/ruby_client/PdfTextResponse.rb +27 -0
  101. data/lib/ruby_client/PdfXmp.rb +67 -0
  102. data/lib/ruby_client/PushButtonInformation.rb +21 -0
  103. data/lib/ruby_client/RC4128Security.rb +62 -0
  104. data/lib/ruby_client/Resource.rb +51 -0
  105. data/lib/ruby_client/ResourceType.rb +48 -0
  106. data/lib/ruby_client/Response.rb +39 -0
  107. data/lib/ruby_client/RgbColor.rb +1048 -0
  108. data/lib/ruby_client/Security.rb +73 -0
  109. data/lib/ruby_client/SecurityType.rb +23 -0
  110. data/lib/ruby_client/SignatureFieldInformation.rb +21 -0
  111. data/lib/ruby_client/Template.rb +46 -0
  112. data/lib/ruby_client/TextFieldInformation.rb +27 -0
  113. data/lib/ruby_client/TextReplace.rb +43 -0
  114. data/lib/ruby_client/UnitConverter.rb +111 -0
  115. data/lib/ruby_client/UrlAction.rb +31 -0
  116. data/lib/ruby_client/VAlign.rb +21 -0
  117. data/lib/ruby_client/WebColor.rb +18 -0
  118. data/lib/ruby_client/WordInput.rb +65 -0
  119. data/lib/ruby_client/WordResource.rb +82 -0
  120. data/lib/ruby_client/XmlResponse.rb +23 -0
  121. data/lib/ruby_client/version.rb +5 -0
  122. data/lib/ruby_client.rb +123 -0
  123. metadata +169 -0
@@ -0,0 +1,28 @@
1
+ module DynamicPDFApi
2
+ require 'base64'
3
+
4
+ require_relative 'BarcodeElement'
5
+ require_relative 'ElementPlacement'
6
+ require_relative 'ValueType'
7
+
8
+ #
9
+ # The base class for 2 dimensional barcode (Aztec, Pdf417, DataMatrixBarcode and QrCode).
10
+ #
11
+ class Dim2BarcodeElement < BarcodeElement
12
+ def initialize(value, placement, x_offset, y_offset)
13
+ if value.is_a?(String)
14
+ @_value_type = ValueType::STRING
15
+ super(value, placement, x_offset, y_offset)
16
+ else
17
+ super(value, placement, x_offset, y_offset)
18
+ @_value_type = ValueType::BASE64_ENCODED_BYTES
19
+ @value = Base64.encode64(value.pack('C*'))
20
+ @placement = placement
21
+ @x_offset = x_offset
22
+ @y_offset = y_offset
23
+ end
24
+ end
25
+
26
+ attr_accessor :_value_type
27
+ end
28
+ end
@@ -0,0 +1,46 @@
1
+ module DynamicPDFApi
2
+ require_relative 'ElementPlacement'
3
+
4
+ #
5
+ # Base class from which all page elements are derived.
6
+ #
7
+ class Element
8
+ def initialize(value = nil, placement = nil, x_offset = 0, y_offset = 0)
9
+ @even_pages = false
10
+ @odd_pages = false
11
+ @_text_font = nil
12
+ @_resource = nil
13
+ @_type = nil
14
+ @_input_value = value
15
+ @placement = placement
16
+ @x_offset = x_offset
17
+ @y_offset = y_offset
18
+ end
19
+ attr_accessor :_type, :_resource, :_input_value, :_text_font
20
+
21
+ #
22
+ # Gets and sets placement of the page element on the page.
23
+ #
24
+ attr_accessor :placement
25
+
26
+ #
27
+ # Gets or sets the X coordinate of the page element.
28
+ #
29
+ attr_accessor :x_offset
30
+
31
+ #
32
+ # Gets or sets the Y coordinate of the page element.
33
+ #
34
+ attr_accessor :y_offset
35
+
36
+ #
37
+ # Gets or sets the boolean value specifying whether the element should be added to even pages or not.
38
+ #
39
+ attr_accessor :even_pages
40
+
41
+ #
42
+ # Gets or sets the boolean value specifying whether the element should be added to odd pages or not.
43
+ #
44
+ attr_accessor :odd_pages
45
+ end
46
+ end
@@ -0,0 +1,36 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents the placement of a page element.
4
+ #
5
+ class ElementPlacement
6
+ #
7
+ # Represents top left placement.
8
+ #
9
+ TOP_LEFT = 'topLeft'.freeze
10
+
11
+ #
12
+ # Represents top center placement.
13
+ #
14
+ TOP_CENTER = 'topCenter'.freeze
15
+
16
+ #
17
+ # Represents top right placement.
18
+ #
19
+ TOP_RIGHT = 'topRight'.freeze
20
+
21
+ #
22
+ # Represents bottom left placement.
23
+ #
24
+ BOTTOM_LEFT = 'bottomLeft'.freeze
25
+
26
+ #
27
+ # Represents bottom center placement.
28
+ #
29
+ BOTTOM_CENTER = 'bottomCenter'.freeze
30
+
31
+ #
32
+ # Represents bottom right placement.
33
+ #
34
+ BOTTOM_RIGHT = 'bottomRight'.freeze
35
+ end
36
+ end
@@ -0,0 +1,96 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents page element type.
4
+ #
5
+ class ElementType
6
+ #
7
+ # Image element.
8
+ #
9
+ IMAGE = "Image".freeze
10
+
11
+ #
12
+ # Text element.
13
+ #
14
+ TEXT = "Text".freeze
15
+
16
+ #
17
+ # Page numbering element.
18
+ #
19
+ PAGE_NUMBERING = "PageNumbering".freeze
20
+
21
+ #
22
+ # Code 128 barcode element.
23
+ #
24
+ CODE128_BARCODE = "Code128Barcode".freeze
25
+
26
+ #
27
+ # Code 39 barcode element.
28
+ #
29
+ CODE39_BARCODE = "Code39Barcode".freeze
30
+
31
+ #
32
+ # Code 2 of 5 barcode element.
33
+ #
34
+ CODE25_BARCODE = "Code25Barcode".freeze
35
+
36
+ #
37
+ # Code 93 barcode element.
38
+ #
39
+ CODE93_BARCODE = "Code93Barcode".freeze
40
+
41
+ #
42
+ # Code 11 barcode element.
43
+ #
44
+ CODE11_BARCODE = "Code11Barcode".freeze
45
+
46
+ #
47
+ # GS1 DataBar barcode element.
48
+ #
49
+ GS1_DATA_BAR_BARCODE = "Gs1DataBarBarcode".freeze
50
+
51
+ #
52
+ # IATA 25 barcode element.
53
+ #
54
+ IATA25_BARCODE = "Iata25Barcode".freeze
55
+
56
+ #
57
+ # MSI barcode element.
58
+ #
59
+ MSI_BARCODE = "MsiBarcode".freeze
60
+
61
+ #
62
+ # Stacked GS1 DataBar barcode element.
63
+ #
64
+ STACKED_GS1_DATA_BAR_BARCODE = "StackedGs1DataBarBarcode".freeze
65
+
66
+ #
67
+ # Aztec barcode element.
68
+ #
69
+ AZTEC_BARCODE = "AztecBarcode".freeze
70
+
71
+ #
72
+ # QR Code barcode element.
73
+ #
74
+ QR_CODE = "QrCode".freeze
75
+
76
+ #
77
+ # PDF417 barcode element.
78
+ #
79
+ PDF417_BARCODE = "Pdf417Barcode".freeze
80
+
81
+ #
82
+ # Data Matrix barcode element.
83
+ #
84
+ DATA_MATRIX_BARCODE = "DataMatrixBarcode".freeze
85
+
86
+ #
87
+ # Rectangle element.
88
+ #
89
+ RECTANGLE = "Rectangle".freeze
90
+
91
+ #
92
+ # Line element.
93
+ #
94
+ LINE = "Line".freeze
95
+ end
96
+ end
@@ -0,0 +1,56 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # The level of error correction to use in a barcode.
4
+ #
5
+ class ErrorCorrection
6
+ #
7
+ # Error Correction Level 0.
8
+ #
9
+ LEVEL_0 = 'level0'.freeze
10
+
11
+ #
12
+ # Error Correction Level 1.
13
+ #
14
+ LEVEL_1 = 'level1'.freeze
15
+
16
+ #
17
+ # Error Correction Level 2.
18
+ #
19
+ LEVEL_2 = 'level2'.freeze
20
+
21
+ #
22
+ # Error Correction Level 3.
23
+ #
24
+ LEVEL_3 = 'level3'.freeze
25
+
26
+ #
27
+ # Error Correction Level 4.
28
+ #
29
+ LEVEL_4 = 'level4'.freeze
30
+
31
+ #
32
+ # Error Correction Level 5.
33
+ #
34
+ LEVEL_5 = 'level5'.freeze
35
+
36
+ #
37
+ # Error Correction Level 6.
38
+ #
39
+ LEVEL_6 = 'level6'.freeze
40
+
41
+ #
42
+ # Error Correction Level 7.
43
+ #
44
+ LEVEL_7 = 'level7'.freeze
45
+
46
+ #
47
+ # Error Correction Level 8.
48
+ #
49
+ LEVEL_8 = 'level8'.freeze
50
+
51
+ #
52
+ # Error Correction Auto.
53
+ #
54
+ AUTO = 'auto'.freeze
55
+ end
56
+ end
@@ -0,0 +1,76 @@
1
+ module DynamicPDFApi
2
+ require_relative "TextBarcodeElement"
3
+ require_relative "ElementType"
4
+
5
+ #
6
+ # Represents a GS1DataBar barcode element.
7
+ #
8
+ # This class can be used to place a GS1DataBar barcode on a page.
9
+ #
10
+ class Gs1DataBarBarcodeElement < TextBarcodeElement
11
+ #
12
+ # Initializes a new instance of the Gs1DataBarBarcodeElement class.
13
+ #
14
+ # @param value [String] The value of the barcode.
15
+ # @param placement [String] The placement of the barcode on the page.
16
+ # @param height [float] The height of the barcode.
17
+ # @param type [String] The GS1DataBarType of the barcode.
18
+ # @param x_offset [float] The X coordinate of the barcode.
19
+ # @param y_offset [float] The Y coordinate of the barcode.
20
+ #
21
+ def initialize(value, height, type, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
22
+ @_type = ElementType::GS1_DATA_BAR_BARCODE
23
+ super(value, placement, x_offset, y_offset)
24
+ @_gs1_data_bar_type = type
25
+ @height = height
26
+ end
27
+
28
+ attr_accessor :_type, :_gs1_data_bar_type, :height
29
+
30
+ #
31
+ # Gets or sets the height of the barcode.
32
+ #
33
+ def to_json(_options = {})
34
+ json_array = {}
35
+
36
+ json_array["type"] = "gs1DataBarBarcode"
37
+
38
+ json_array["gs1DataBarType"] = @_gs1_data_bar_type unless @_gs1_data_bar_type.nil?
39
+
40
+ json_array["height"] = @height unless @height.nil?
41
+
42
+ #----------------TextBarcodeElement---------------------------------
43
+ json_array["font"] = @_font_name unless @_font_name.nil?
44
+
45
+ json_array["textColor"] = @text_color._color_string if !@text_color.nil? && !@text_color._color_string.nil?
46
+
47
+ json_array["fontSize"] = @font_size unless @font_size.nil?
48
+
49
+ json_array["showText"] = @show_text if @show_text != "nil"
50
+
51
+ #----------------barcodeElement--------------------------------
52
+
53
+ json_array["color"] = @color._color_string if !@color.nil? && !@color._color_string.nil?
54
+
55
+ json_array["xDimension"] = @x_dimension unless @x_dimension.nil?
56
+
57
+ json_array["value"] = @value unless @value.nil?
58
+
59
+ # ------------element---------------------
60
+
61
+ json_array["placement"] = @placement unless @placement.nil?
62
+
63
+ json_array["xOffset"] = @x_offset unless @x_offset.nil?
64
+
65
+ json_array["yOffset"] = @y_offset unless @y_offset.nil?
66
+
67
+ # if(@even_pages != nil)
68
+ json_array["evenPages"] = @even_pages
69
+
70
+ # if(@odd_pages != nil)
71
+ json_array["oddPages"] = @odd_pages
72
+
73
+ JSON.pretty_generate(json_array)
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,22 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents GS1 DataBar types.
4
+ #
5
+ class Gs1DataBarType
6
+ #
7
+ # Omnidirectional GS1 DataBar type.
8
+ #
9
+ OMNIDIRECTIONAL = 'omnidirectional'.freeze
10
+
11
+ #
12
+ # Limited GS1 DataBar type.
13
+ #
14
+ #
15
+ LIMITED = 'limited'.freeze
16
+
17
+ #
18
+ # Expanded GS1 DataBar type.
19
+ #
20
+ EXPANDED = 'expanded'.freeze
21
+ end
22
+ end
@@ -0,0 +1,83 @@
1
+ module DynamicPDFApi
2
+ require_relative 'TextBarcodeElement'
3
+ require_relative 'ElementType'
4
+
5
+ #
6
+ # Represents an IATA 2 of 5 barcode element.
7
+ #
8
+ # This class can be used to place an IATA 2 of 5 barcode on a page.
9
+ #
10
+ class Iata25BarcodeElement < TextBarcodeElement
11
+ #
12
+ # Initializes a new instance of the Iata25BarcodeElement class.
13
+ #
14
+ # @param value [String] The value of the barcode.
15
+ # @param placement [String] The placement of the barcode on the page.
16
+ # @param height [float] The height of the barcode.
17
+ # @param x_offset [float] The X coordinate of the barcode.
18
+ # @param y_offset [float] The Y coordinate of the barcode.
19
+ #
20
+ def initialize(value, height, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
21
+ @_type = ElementType::IATA25_BARCODE
22
+ @include_check_digit = false
23
+ @height = height
24
+ super(value, placement, x_offset, y_offset)
25
+ end
26
+
27
+ attr_accessor :_type
28
+
29
+ #
30
+ # Gets or sets a value indicating if the check digit should be added to the value.
31
+ #
32
+ attr_accessor :include_check_digit
33
+
34
+ #
35
+ # Gets or sets the height of the barcode.
36
+ #
37
+ attr_accessor :height
38
+
39
+ def to_json(_options = {})
40
+ json_array = {}
41
+
42
+ json_array['type'] = 'iata25Barcode'
43
+
44
+ # if(@IncludeCheckDigit != nil)
45
+ json_array['includeCheckDigit'] = @include_check_digit
46
+
47
+ json_array['height'] = @height unless @height.nil?
48
+
49
+ #----------------TextBarcodeElement---------------------------------
50
+ json_array['font'] = @_font_name unless @_font_name.nil?
51
+
52
+ json_array['textColor'] = @text_color._color_string if !@text_color.nil? && !@text_color._color_string.nil?
53
+
54
+ json_array['fontSize'] = @font_size unless @font_size.nil?
55
+
56
+ json_array['showText'] = @show_text if @show_text != 'nil'
57
+
58
+ #----------------barcodeElement--------------------------------
59
+
60
+ json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil?
61
+
62
+ json_array['xDimension'] = @x_dimension unless @x_dimension.nil?
63
+
64
+ json_array['value'] = @value unless @value.nil?
65
+
66
+ # ------------element---------------------
67
+
68
+ json_array['placement'] = @placement unless @placement.nil?
69
+
70
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
71
+
72
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
73
+
74
+ # if(@even_pages != nil)
75
+ json_array['evenPages'] = @even_pages
76
+
77
+ # if(@odd_pages != nil)
78
+ json_array['oddPages'] = @odd_pages
79
+
80
+ JSON.pretty_generate(json_array)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,108 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Element'
3
+ require_relative 'ElementType'
4
+
5
+ #
6
+ # Represents an image element.
7
+ #
8
+ # This class can be used to place images on a page.
9
+ #
10
+ class ImageElement < Element
11
+ #
12
+ # Initializes a new instance of the ImageElement class.
13
+ #
14
+ # @param resource [ImageResource]|[String] ImageResource object containing the image resource or the name of the image resource.
15
+ # @param placement [String] The placement of the image on the page.
16
+ # @param x_offset [float] X coordinate of the image.
17
+ # @param y_offset [float] Y coordinate of the image.
18
+ #
19
+ def initialize(resource, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
20
+ super()
21
+ @_type = ElementType::IMAGE
22
+ @_resource = nil
23
+ @_resource_name = nil
24
+
25
+ if resource.is_a?(String)
26
+ @_resource_name = resource
27
+ else
28
+ # super()
29
+ @_resource = resource
30
+ @_resource_name = resource.resource_name
31
+ end
32
+
33
+ @placement = placement
34
+ @x_offset = x_offset
35
+ @y_offset = y_offset
36
+ end
37
+
38
+ #
39
+ # Initializes a new instance of the ImageElement class.
40
+ #
41
+ # @param resourceName [String] The name of the image resource.
42
+ # @param placement [String] The placement of the image on the page.
43
+ # @param x_offset [float] X coordinate of the image.
44
+ # @param y_offset [float] Y coordinate of the image.
45
+ #
46
+ # @return ImageElement returns ImageElement object.
47
+ #
48
+ def self.create_image_element(resource_name, placement, x_offset = 0, y_offset = 0)
49
+ image_element = new ImageElement(nil, nil)
50
+ image_element._resource_name = resource_name
51
+ image_element.placement = placement
52
+ image_element.x_offset = x_offset
53
+ image_element.y_offset = y_offset
54
+ image_element
55
+ end
56
+
57
+ attr_accessor :_resource_name
58
+
59
+ #
60
+ # Gets or sets the horizontal scale of the image.
61
+ #
62
+ attr_accessor :scale_x
63
+
64
+ #
65
+ # Gets or sets the vertical scale of the image.
66
+ #
67
+ attr_accessor :scale_y
68
+
69
+ #
70
+ # Gets or sets the maximum height of the image.
71
+ #
72
+ attr_accessor :max_height
73
+
74
+ #
75
+ # Gets or sets the maximum width of the image.
76
+ #
77
+ attr_accessor :max_width
78
+
79
+ def to_json(_options = {})
80
+ json_array = {}
81
+ json_array['type'] = 'image'
82
+
83
+ json_array['resourceName'] = @_resource_name unless @_resource_name.nil?
84
+
85
+ json_array['scaleX'] = @scale_x unless @scale_x.nil?
86
+
87
+ json_array['scaleY'] = @scale_y unless @scale_y.nil?
88
+
89
+ json_array['maxHeight'] = @max_height unless @max_height.nil?
90
+
91
+ json_array['maxWidth'] = @max_width unless @max_width.nil?
92
+
93
+ # ---------------------------------
94
+
95
+ json_array['placement'] = @placement unless @placement.nil?
96
+
97
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
98
+
99
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
100
+
101
+ json_array['evenPages'] = @even_pages unless @even_pages.nil?
102
+
103
+ json_array['oddPages'] = @odd_pages unless @odd_pages.nil?
104
+
105
+ JSON.pretty_generate(json_array)
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,92 @@
1
+ module DynamicPDFApi
2
+ require_relative "Element"
3
+ require_relative "ElementPlacement"
4
+ require_relative "ElementType"
5
+ require_relative "../LineStyle"
6
+ #
7
+ # Represents a line page element.
8
+ #
9
+ # This class can be used to place lines of different length, width, color and patterns on a page.
10
+ #
11
+ class LineElement < Element
12
+ #
13
+ # Initializes a new instance of the LineElement class.
14
+ #
15
+ # @param placement [String] The placement of the line on the page.
16
+ # @param x2_offset [float] X2 coordinate of the line.
17
+ # @param y2_offset [float] Y2 coordinate of the line.
18
+ #
19
+ def initialize(x2_offset, y2_offset, placement = ElementPlacement::TOP_LEFT)
20
+ super()
21
+ @color = nil
22
+ @width = nil
23
+ @line_style = nil
24
+ @_type = ElementType::LINE
25
+
26
+ @placement = placement
27
+ @x2_offset = x2_offset
28
+ @y2_offset = y2_offset
29
+ end
30
+
31
+ #
32
+ # Gets or sets the Color object to use for the line.
33
+ #
34
+ attr_accessor :color
35
+
36
+ #
37
+ # Gets or sets the X2 coordinate of the line.
38
+ #
39
+ attr_accessor :x2_offset
40
+
41
+ #
42
+ # Gets or sets the Y2 coordinate of the line.
43
+ #
44
+ attr_accessor :y2_offset
45
+
46
+ #
47
+ # Gets or sets the width of the line.
48
+ #
49
+ attr_accessor :width
50
+
51
+ #
52
+ # Gets or sets the LineStyle object to use for the style of the line.
53
+ #
54
+ attr_accessor :line_style
55
+
56
+ def to_json(_options = {})
57
+ json_array = {}
58
+ json_array["type"] = "line"
59
+
60
+ json_array["color"] = @color._color_string if !@color.nil? && !@color._color_string.nil?
61
+
62
+ json_array["xOffset"] = @x_offset unless @x_offset.nil?
63
+
64
+ json_array["yOffset"] = @y_offset unless @y_offset.nil?
65
+
66
+ json_array["x2Offset"] = @x2_offset unless @x2_offset.nil?
67
+
68
+ json_array["y2Offset"] = @y2_offset unless @y2_offset.nil?
69
+
70
+ json_array["width"] = @width unless @width.nil?
71
+
72
+ if !@line_style.nil? && !@line_style._line_style_string.nil?
73
+ json_array["lineStyle"] =
74
+ @line_style._line_style_string
75
+ end
76
+
77
+ # ---------------------------------
78
+
79
+ json_array["placement"] = @placement unless @placement.nil?
80
+
81
+ json_array["xOffset"] = @x_offset unless @x_offset.nil?
82
+
83
+ json_array["yOffset"] = @y_offset unless @y_offset.nil?
84
+
85
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
86
+
87
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
88
+
89
+ JSON.pretty_generate(json_array)
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # MSI Barcode check digit modes.
4
+ #
5
+ class MsiBarcodeCheckDigitMode
6
+ #
7
+ # No check digit.
8
+ #
9
+ NONE = 'none'.freeze
10
+
11
+ #
12
+ # check digit of mod 10.
13
+ #
14
+ MOD10 = 'mod10'.freeze
15
+
16
+ #
17
+ # check digit of mod 11.
18
+ #
19
+ MOD11 = 'mod11'.freeze
20
+
21
+ #
22
+ # check digit of mod 1010.
23
+ #
24
+ MOD1010 = 'mod1010'.freeze
25
+
26
+ #
27
+ # check digit of mod 1110.
28
+ #
29
+ MOD1110 = 'mod1110'.freeze
30
+ end
31
+ end