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,79 @@
1
+ module DynamicPDFApi
2
+ require_relative 'TextBarcodeElement'
3
+ require_relative 'ElementType'
4
+
5
+ #
6
+ # Represents a MSI Barcode element (also known as Modified Plessey).
7
+ #
8
+ class MsiBarcodeElement < TextBarcodeElement
9
+ #
10
+ # Initializes a new instance of the MsiBarcodeElement class.
11
+ #
12
+ # @param value [String] The value of the barcode.
13
+ # @param placement [String] The placement of the barcode on the page.
14
+ # @param height [float] The height of the barcode.
15
+ # @param x_offset [float] The X coordinate of the barcode.
16
+ # @param y_offset [float] The Y coordinate of the barcode.
17
+ #
18
+ def initialize(value, height, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
19
+ @append_check_digit = nil
20
+ @height = height
21
+ super(value, placement, x_offset, y_offset)
22
+ @_type = ElementType::MSI_BARCODE
23
+ end
24
+
25
+ attr_accessor :_type
26
+
27
+ #
28
+ # Gets or sets a value specifying if the check digit should calculated.
29
+ #
30
+ attr_accessor :append_check_digit
31
+ #
32
+ # Gets or sets the height of the barcode.
33
+ #
34
+ attr_accessor :height
35
+
36
+ def to_json(_options = {})
37
+ json_array = {}
38
+
39
+ json_array['type'] = 'msiBarcode'
40
+
41
+ json_array['appendCheckDigit'] = @append_check_digit unless @append_check_digit.nil?
42
+
43
+ json_array['height'] = @height unless @height.nil?
44
+
45
+ #----------------TextBarcodeElement---------------------------------
46
+ json_array['font'] = @_font_name unless @_font_name.nil?
47
+
48
+ json_array['textColor'] = @text_color._color_string if !@text_color.nil? && !@text_color._color_string.nil?
49
+
50
+ json_array['fontSize'] = @font_size unless @font_size.nil?
51
+
52
+ json_array['showText'] = @show_text if @show_text != 'nil'
53
+
54
+ #----------------barcodeElement--------------------------------
55
+
56
+ json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil?
57
+
58
+ json_array['xDimension'] = @x_dimension unless @x_dimension.nil?
59
+
60
+ json_array['value'] = @value unless @value.nil?
61
+
62
+ # ------------element---------------------
63
+
64
+ json_array['placement'] = @placement unless @placement.nil?
65
+
66
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
67
+
68
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
69
+
70
+ # if(@even_pages != nil)
71
+ json_array['evenPages'] = @even_pages
72
+
73
+ # if(@odd_pages != nil)
74
+ json_array['oddPages'] = @odd_pages
75
+
76
+ JSON.pretty_generate(json_array)
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,91 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Element'
3
+ require_relative 'ElementType'
4
+ require_relative '../Font'
5
+ #
6
+ # Represents a page numbering label page element.
7
+ #
8
+ # This class can be used to add page numbering to a PDF document. The following tokens can be used within
9
+ # the text of a PageNumberingLabel. They will be replaced with the appropriate value when the PDF is output.
10
+ # table All tokens except the /%/%PR/%/% token can also contain a numbering style specifier. The numbering
11
+ # style specifier is placed in parenthesis after the token. table There should be no spaces within a token,
12
+ # only the token and optional numbering style specifier. This token is invalid /%/%CP ( i )/%/% because
13
+ # of the extra spaces.Here are some examples of valid tokens: margin-top: 0px
14
+ #
15
+ class PageNumberingElement < Element
16
+ #
17
+ # Initializes a new instance of the PageNumberingElement class.
18
+ #
19
+ # @param text [String] Text to display in the label.
20
+ # @param placement [String] The placement of the page numbering element on the page.
21
+ # @param x_offset [float] X coordinate of the label.
22
+ # @param y_offset [float] Y coordinate of the label.
23
+ #
24
+ def initialize(text, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
25
+ @_font_name = nil
26
+ @color = nil
27
+ @font_size = nil
28
+
29
+ @_text_font = nil
30
+ @_resource = nil
31
+ @_type = ElementType::PAGE_NUMBERING
32
+
33
+ super(text, placement, x_offset, y_offset)
34
+ @text = text
35
+ end
36
+
37
+ attr_accessor :_font_name
38
+
39
+ #
40
+ # Gets or sets the Color object to use for the text of the label.
41
+ #
42
+ attr_accessor :color
43
+
44
+ #
45
+ # Gets or sets the font size for the text of the label.
46
+ #
47
+ attr_accessor :font_size
48
+
49
+ #
50
+ # Gets or sets the text to display in the label.
51
+ #
52
+ attr_accessor :text
53
+
54
+ #
55
+ # Gets or sets the Font object to use for the text of the label.
56
+ #
57
+ def font(value)
58
+ @_text_font = value
59
+ @_font_name = @_text_font._name
60
+ @_resource = @_text_font._resource
61
+ end
62
+
63
+ def to_json(_options = {})
64
+ json_array = {}
65
+
66
+ json_array['type'] = 'pageNumbering'
67
+
68
+ json_array['font'] = @_font_name unless @_font_name.nil?
69
+
70
+ json_array['text'] = @text
71
+
72
+ json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil?
73
+
74
+ json_array['fontSize'] = @font_size unless @font_size.nil?
75
+
76
+ # ---------------------------------
77
+
78
+ json_array['placement'] = @placement unless @placement.nil?
79
+
80
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
81
+
82
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
83
+
84
+ json_array['evenPages'] = @even_pages unless @even_pages.nil?
85
+
86
+ json_array['oddPages'] = @odd_pages unless @odd_pages.nil?
87
+
88
+ JSON.pretty_generate(json_array).gsub('\\\\', '\\').gsub('\"', '"').gsub('\\\r', '\r').gsub('\\\n', '\n').gsub('\\\t', '\t')
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,112 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Dim2BarcodeElement'
3
+ require_relative 'ErrorCorrection'
4
+ require_relative 'ElementType'
5
+ require_relative 'Compaction'
6
+
7
+ #
8
+ # Represents Pdf417 barcode element.
9
+ #
10
+ # This class can be used to generate Pdf417 barcode symbol.
11
+ #
12
+ class Pdf417BarcodeElement < Dim2BarcodeElement
13
+ #
14
+ # Initializes a new instance of the Pdf417BarcodeElement class.
15
+ #
16
+ # @param value [String]|array String to be encoded either as string or byte array.
17
+ # @param placement [String] The placement of the barcode on the page.
18
+ # @param columns int [Columns] of the PDF417 barcode.
19
+ # @param x_offset [float] The X coordinate of the PDF417 barcode.
20
+ # @param y_offset [float] The Y coordinate of the PDF417 barcode.
21
+ #
22
+ def initialize(value, columns, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
23
+ @columns = nil
24
+ @y_dimension = nil
25
+ @process_tilde = false
26
+ @compact_pdf417 = false
27
+ @error_correction = nil
28
+ @compaction = nil
29
+
30
+ super(value, placement, x_offset, y_offset)
31
+ @columns = columns
32
+ @_type = ElementType::PDF417_BARCODE
33
+ end
34
+
35
+ attr_accessor :_type
36
+
37
+ #
38
+ # Gets or sets the columns of the barcode.
39
+ #
40
+ attr_accessor :columns
41
+
42
+ #
43
+ # Gets or sets the YDimension of the barcode.
44
+ #
45
+ attr_accessor :y_dimension
46
+
47
+ #
48
+ # Gets or Sets a boolean indicating whether to process the tilde character.
49
+ #
50
+ attr_accessor :process_tilde
51
+ #
52
+ # Gets or sets the Compact Pdf417.
53
+ #
54
+ attr_accessor :compact_pdf417
55
+ #
56
+ # Gets or sets the error correction level for the PDF417 barcode.
57
+ #
58
+ attr_accessor :error_correction
59
+ #
60
+ # Gets or sets the type of compaction.
61
+ #
62
+ attr_accessor :compaction
63
+
64
+ def to_json(_options = {})
65
+ json_array = {}
66
+
67
+ json_array['type'] = 'pdf417Barcode'
68
+
69
+ json_array['columns'] = @columns unless @columns.nil?
70
+
71
+ json_array['yDimension'] = @y_dimension unless @y_dimension.nil?
72
+
73
+ # if(@process_tilde != nil)
74
+ json_array['processTilde'] = @process_tilde
75
+
76
+ # if(@CompactPdf417 != nil)
77
+ json_array['compactPdf417'] = @compact_pdf417
78
+
79
+ json_array['errorCorrection'] = @error_correction unless @error_correction.nil?
80
+
81
+ json_array['compaction'] = @compaction unless @compaction.nil?
82
+
83
+ #--------------Dim2BarcodeElement------------------------------
84
+
85
+ json_array['valueType'] = @_value_type unless @_value_type.nil?
86
+
87
+ #----------------barcodeElement--------------------------------
88
+
89
+ json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil?
90
+
91
+ json_array['xDimension'] = @x_dimension unless @x_dimension.nil?
92
+
93
+ json_array['value'] = @value unless @value.nil?
94
+
95
+ # ------------element---------------------
96
+
97
+ json_array['placement'] = @placement unless @placement.nil?
98
+
99
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
100
+
101
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
102
+
103
+ # if(@even_pages != nil)
104
+ json_array['evenPages'] = @even_pages
105
+
106
+ # if(@odd_pages != nil)
107
+ json_array['oddPages'] = @odd_pages
108
+
109
+ JSON.pretty_generate(json_array)
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,77 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Dim2BarcodeElement'
3
+ require_relative 'ElementType'
4
+
5
+ #
6
+ #
7
+ # Represents a QR code barcode element.
8
+ #
9
+ # With some of the .Net runtime (example: .Net Core 2.0), the Kanchi encoding will give the error 'No
10
+ # data is available for encoding 932. For information on defining a custom encoding, see the documentation
11
+ # for the Encoding.RegisterProvider method.'.
12
+ #
13
+ class QrCodeElement < Dim2BarcodeElement
14
+ #
15
+ # Initializes a new instance of the QrCodeElement class.
16
+ #
17
+ # @param value [String]|array The value of the QR code either as string or byte array.
18
+ # @param placement [String] The placement of the barcode on the page.
19
+ # @param x_offset [float] The X coordinate of the QR code.
20
+ # @param y_offset [float] The Y coordinate of the QR code.
21
+ #
22
+ def initialize(value, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
23
+ super(value, placement, x_offset, y_offset)
24
+ @_type = ElementType::QR_CODE
25
+ end
26
+
27
+ attr_accessor :_type
28
+
29
+ #
30
+ # Gets or sets FNC1 mode.
31
+ #
32
+ attr_accessor :fnc1
33
+
34
+ #
35
+ # Gets or sets the QR code version.
36
+ #
37
+ attr_accessor :version
38
+
39
+ def to_json(_options = {})
40
+ json_array = {}
41
+
42
+ json_array['type'] = 'qrCode'
43
+
44
+ json_array['fnc1'] = @fnc1 unless @fnc1.nil?
45
+
46
+ json_array['version'] = @version unless @version.nil?
47
+
48
+ #--------------Dim2BarcodeElement------------------------------
49
+
50
+ json_array['valueType'] = @_value_type unless @_value_type.nil?
51
+
52
+ #----------------barcodeElement--------------------------------
53
+
54
+ json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil?
55
+
56
+ json_array['xDimension'] = @x_dimension unless @x_dimension.nil?
57
+
58
+ json_array['value'] = @value unless @value.nil?
59
+
60
+ # ------------element---------------------
61
+
62
+ json_array['placement'] = @placement unless @placement.nil?
63
+
64
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
65
+
66
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
67
+
68
+ # if(@even_pages != nil)
69
+ json_array['evenPages'] = @even_pages
70
+
71
+ # if(@odd_pages != nil)
72
+ json_array['oddPages'] = @odd_pages
73
+
74
+ JSON.pretty_generate(json_array)
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,22 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # The type of FNC1 mode to use.
4
+ #
5
+ class QrCodeFnc1
6
+
7
+ #
8
+ # FNC1 Gs1.
9
+ #
10
+ GS1 = 'gs1'.freeze
11
+
12
+ #
13
+ # FNC1 Industry.
14
+ #
15
+ INDUSTRY = 'industry'.freeze
16
+
17
+ #
18
+ # FNC1 None.
19
+ #
20
+ NONE = 'none'.freeze
21
+ end
22
+ end
@@ -0,0 +1,109 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Element'
3
+ require_relative 'ElementPlacement'
4
+ require_relative 'ElementType'
5
+
6
+ #
7
+ # Represents a rectangle page element.
8
+ #
9
+ # This class can be used to place rectangles of any size or color on a page.
10
+ #
11
+ class RectangleElement < Element
12
+ #
13
+ # Initializes a new instance of the RectangleElement class.
14
+ #
15
+ # @param placement [String] The placement of the rectangle on the page.
16
+ # @param width [float] Width of the rectangle.
17
+ # @param height [float] Height of the rectangle.
18
+ #
19
+ def initialize(width, height,placement= ElementPlacement::TOP_LEFT)
20
+ super()
21
+ @_type = ElementType::RECTANGLE
22
+ @border_width = nil
23
+ @corner_radius = nil
24
+ @border_style = nil
25
+ @border_color = nil
26
+ @fill_color = nil
27
+
28
+ @placement = placement
29
+ @width = width
30
+ @height = height
31
+ end
32
+
33
+ #
34
+ # Gets or sets the width of the rectangle.
35
+ #
36
+ attr_accessor :width
37
+
38
+ #
39
+ # Gets or sets the height of the rectangle.
40
+ #
41
+ attr_accessor :height
42
+
43
+ #
44
+ # Gets or sets the border width of the rectangle.
45
+ #
46
+ # To force the borders not to appear set the border width to any value 0 or less.
47
+ #
48
+ attr_accessor :border_width
49
+
50
+ #
51
+ # Gets or sets the corner radius of the rectangle.
52
+ #
53
+ attr_accessor :corner_radius
54
+ #
55
+ # Gets or sets the LineStyle object used to specify the border style of the rectangle.
56
+ #
57
+ attr_accessor :border_style
58
+ #
59
+ # Gets or sets the Color object to use for the border of the rectangle.
60
+ #
61
+ attr_accessor :border_color
62
+ #
63
+ # Gets or sets the Color object to use for the fill of the rectangle.
64
+ #
65
+ # To force no color to appear in the rectangle (only borders) set the fill color to nil (Nothing in Visual
66
+ # Basic).
67
+ #
68
+ attr_accessor :fill_color
69
+
70
+ def to_json(_options = {})
71
+ # 'width':100.0,'height':50.0,'cornerRadius':0.0,'placement':'topCenter','xOffset':0.0,'yOffset':0.0
72
+ json_array = {}
73
+ json_array['type'] = 'rectangle'
74
+
75
+ json_array['width'] = @width unless @width.nil?
76
+
77
+ json_array['height'] = @height unless @height.nil?
78
+
79
+ json_array['borderWidth'] = @border_width unless @border_width.nil?
80
+
81
+ json_array['cornerRadius'] = @corner_radius unless @corner_radius.nil?
82
+
83
+ json_array['fillColor'] = @fill_color._color_string if !@fill_color.nil? && !@fill_color._color_string.nil?
84
+
85
+ if !@border_style.nil? && !@border_style._line_style_string.nil?
86
+ json_array['borderStyle'] = @border_style._line_style_string
87
+ end
88
+
89
+ if !@border_color.nil? && !@border_color._color_string.nil?
90
+ json_array['borderColor'] =
91
+ @border_color._color_string
92
+ end
93
+
94
+ # ---------------------------------
95
+
96
+ json_array['placement'] = @placement unless @placement.nil?
97
+
98
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
99
+
100
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
101
+
102
+ json_array['evenPages'] = @even_pages unless @even_pages.nil?
103
+
104
+ json_array['oddPages'] = @odd_pages unless @odd_pages.nil?
105
+
106
+ JSON.pretty_generate(json_array)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,90 @@
1
+ module DynamicPDFApi
2
+ require_relative 'TextBarcodeElement'
3
+ require_relative 'ElementType'
4
+
5
+ #
6
+ # Represents a StackedGS1DataBar barcode element.
7
+ #
8
+ # This class can be used to place a StackedGS1DataBar barcode on a page.
9
+ #
10
+ class StackedGs1DataBarBarcodeElement < TextBarcodeElement
11
+ #
12
+ # Initializes a new instance of the StackedGs1DataBarBarcodeElement 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 stacked_gs1_data_bar_type [String] The StackedGS1DataBarType of the barcode.
17
+ # @param row_height [float] The row height 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, stacked_gs1_data_bar_type, row_height, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
22
+ super(value, placement, x_offset, y_offset)
23
+ @_stacked_gs1_data_bar_type = stacked_gs1_data_bar_type
24
+ @row_height = row_height
25
+ @_type = ElementType::STACKED_GS1_DATA_BAR_BARCODE
26
+ end
27
+
28
+ attr_accessor :_type, :_stacked_gs1_data_bar_type
29
+
30
+ #
31
+ # Gets or Sets the segment count of the Expanded Stacked barcode.
32
+ #
33
+ # This is used only for the ExpandedStacked Gs1DataBar type.
34
+ #
35
+ attr_accessor :expanded_stacked_segment_count
36
+
37
+ #
38
+ # Gets or sets the row height of the barcode.
39
+ #
40
+ attr_accessor :row_height
41
+
42
+ def to_json(_options = {})
43
+ json_array = {}
44
+
45
+ json_array['type'] = 'stackedGs1DataBarBarcode'
46
+
47
+ json_array['stackedGs1DataBarType'] = @_stacked_gs1_data_bar_type unless @_stacked_gs1_data_bar_type.nil?
48
+
49
+ unless @expanded_stacked_segment_count.nil?
50
+ json_array['expandedStackedSegmentCount'] =
51
+ @expanded_stacked_segment_count
52
+ end
53
+
54
+ json_array['rowHeight'] = @row_height unless @row_height.nil?
55
+
56
+ #----------------TextBarcodeElement---------------------------------
57
+ json_array['font'] = @_font_name unless @_font_name.nil?
58
+
59
+ json_array['textColor'] = @text_color._color_string if !@text_color.nil? && !@text_color._color_string.nil?
60
+
61
+ json_array['fontSize'] = @font_size unless @font_size.nil?
62
+
63
+ json_array['showText'] = @show_text if @show_text != 'nil'
64
+
65
+ #----------------barcodeElement--------------------------------
66
+
67
+ json_array['color'] = @color._color_string if !@color.nil? && !@color._color_string.nil?
68
+
69
+ json_array['xDimension'] = @x_dimension unless @x_dimension.nil?
70
+
71
+ json_array['value'] = @value unless @value.nil?
72
+
73
+ # ------------element---------------------
74
+
75
+ json_array['placement'] = @placement unless @placement.nil?
76
+
77
+ json_array['xOffset'] = @x_offset unless @x_offset.nil?
78
+
79
+ json_array['yOffset'] = @y_offset unless @y_offset.nil?
80
+
81
+ # if(@even_pages != nil)
82
+ json_array['evenPages'] = @even_pages
83
+
84
+ # if(@odd_pages != nil)
85
+ json_array['oddPages'] = @odd_pages
86
+
87
+ JSON.pretty_generate(json_array)
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,23 @@
1
+ module DynamicPDFApi
2
+ #
3
+ #
4
+ # Represents Stacked GS1 DataBar types.
5
+ #
6
+ #
7
+ class StackedGs1DataBarType
8
+ #
9
+ # Stacked type.
10
+ #
11
+ STACKED = 'stacked'.freeze
12
+
13
+ #
14
+ # Stacked Omnidirectional type.
15
+ #
16
+ STACKED_OMNIDIRECTIONAL = 'stackedOmnidirectional'.freeze
17
+
18
+ #
19
+ # Expanded stacked type.
20
+ #
21
+ EXPANDED_STACKED = 'expandedStacked'.freeze
22
+ end
23
+ end
@@ -0,0 +1,48 @@
1
+ module DynamicPDFApi
2
+ require_relative 'BarcodeElement'
3
+
4
+ #
5
+ # Base class from which barcode page elements that display text are derived.
6
+ #
7
+ class TextBarcodeElement < BarcodeElement
8
+ def initialize(value, placement, x_offset, y_offset)
9
+ @text_color = nil
10
+ @font_size = nil
11
+ @show_text = 'nil'
12
+ @_resource = nil
13
+ @_text_font = nil
14
+ @_font_name = nil
15
+ super(value, placement, x_offset, y_offset)
16
+ end
17
+
18
+ #
19
+ # Gets or sets the color of the text.
20
+ #
21
+ attr_accessor :text_color
22
+
23
+ #
24
+ # Gets or sets the font size to use when displaying the text.
25
+ #
26
+ attr_accessor :font_size
27
+
28
+ #
29
+ # Gets or sets a value indicating if the value should be placed as text below the barcode.
30
+ #
31
+ attr_accessor :show_text
32
+
33
+ attr_accessor :_resource, :_text_font, :_font_name
34
+
35
+ #
36
+ # Gets or sets the font to use when displaying the text.
37
+ #
38
+ def font(value)
39
+ @_text_font = value
40
+ @_font_name = @_text_font._name
41
+ @_resource = @_text_font._resource
42
+ end
43
+
44
+ def get_font
45
+ @_text_font
46
+ end
47
+ end
48
+ end