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.
- checksums.yaml +7 -0
- data/lib/ruby_client/Action.rb +15 -0
- data/lib/ruby_client/AdditionalResource.rb +113 -0
- data/lib/ruby_client/AdditionalResourceType.rb +27 -0
- data/lib/ruby_client/Aes128Security.rb +70 -0
- data/lib/ruby_client/Aes256Security.rb +70 -0
- data/lib/ruby_client/Align.rb +21 -0
- data/lib/ruby_client/ButtonFieldInformation.rb +48 -0
- data/lib/ruby_client/ButtonFieldType.rb +16 -0
- data/lib/ruby_client/ChoiceFieldInformation.rb +52 -0
- data/lib/ruby_client/ChoiceFieldType.rb +16 -0
- data/lib/ruby_client/CmykColor.rb +47 -0
- data/lib/ruby_client/Color.rb +12 -0
- data/lib/ruby_client/ColorSpaceType.rb +36 -0
- data/lib/ruby_client/ConverterInput.rb +100 -0
- data/lib/ruby_client/DlexInput.rb +61 -0
- data/lib/ruby_client/DlexLayout.rb +135 -0
- data/lib/ruby_client/DlexResource.rb +40 -0
- data/lib/ruby_client/Elements/AztecBarcodeElement.rb +113 -0
- data/lib/ruby_client/Elements/AztecSymbolSize.rb +206 -0
- data/lib/ruby_client/Elements/BarcodeElement.rb +37 -0
- data/lib/ruby_client/Elements/Code11BarcodeElement.rb +77 -0
- data/lib/ruby_client/Elements/Code128BarcodeElement.rb +105 -0
- data/lib/ruby_client/Elements/Code25BarcodeElement.rb +75 -0
- data/lib/ruby_client/Elements/Code39BarcodeElement.rb +75 -0
- data/lib/ruby_client/Elements/Code93BarcodeElement.rb +75 -0
- data/lib/ruby_client/Elements/Compaction.rb +26 -0
- data/lib/ruby_client/Elements/DataMatrixBarcodeElement.rb +95 -0
- data/lib/ruby_client/Elements/DataMatrixEncodingType.rb +56 -0
- data/lib/ruby_client/Elements/DataMatrixFunctionCharacter.rb +31 -0
- data/lib/ruby_client/Elements/DataMatrixSymbolSize.rb +161 -0
- data/lib/ruby_client/Elements/Dim2BarcodeElement.rb +28 -0
- data/lib/ruby_client/Elements/Element.rb +46 -0
- data/lib/ruby_client/Elements/ElementPlacement.rb +36 -0
- data/lib/ruby_client/Elements/ElementType.rb +96 -0
- data/lib/ruby_client/Elements/ErrorCorrection.rb +56 -0
- data/lib/ruby_client/Elements/Gs1DataBarBarcodeElement.rb +76 -0
- data/lib/ruby_client/Elements/Gs1DataBarType.rb +22 -0
- data/lib/ruby_client/Elements/Iata25BarcodeElement.rb +83 -0
- data/lib/ruby_client/Elements/ImageElement.rb +108 -0
- data/lib/ruby_client/Elements/LineElement.rb +92 -0
- data/lib/ruby_client/Elements/MsiBarcodeCheckDigitMode.rb +31 -0
- data/lib/ruby_client/Elements/MsiBarcodeElement.rb +79 -0
- data/lib/ruby_client/Elements/PageNumberingElement.rb +91 -0
- data/lib/ruby_client/Elements/Pdf417BarcodeElement.rb +112 -0
- data/lib/ruby_client/Elements/QrCodeElement.rb +77 -0
- data/lib/ruby_client/Elements/QrCodeFnc1.rb +22 -0
- data/lib/ruby_client/Elements/RectangleElement.rb +109 -0
- data/lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb +90 -0
- data/lib/ruby_client/Elements/StackedGs1DataBarType.rb +23 -0
- data/lib/ruby_client/Elements/TextBarcodeElement.rb +48 -0
- data/lib/ruby_client/Elements/TextElement.rb +83 -0
- data/lib/ruby_client/Elements/ValueType.rb +16 -0
- data/lib/ruby_client/EncryptDocumentComponents.rb +16 -0
- data/lib/ruby_client/EndPointException.rb +7 -0
- data/lib/ruby_client/Endpoint.rb +38 -0
- data/lib/ruby_client/EndpointResource.rb +7 -0
- data/lib/ruby_client/ExcelInput.rb +49 -0
- data/lib/ruby_client/ExcelResource.rb +79 -0
- data/lib/ruby_client/Font.rb +276 -0
- data/lib/ruby_client/FontInformation.rb +9 -0
- data/lib/ruby_client/FontResource.rb +35 -0
- data/lib/ruby_client/FormField.rb +62 -0
- data/lib/ruby_client/FormFieldInformation.rb +45 -0
- data/lib/ruby_client/GoToAction.rb +53 -0
- data/lib/ruby_client/Grayscale.rb +41 -0
- data/lib/ruby_client/HtmlInput.rb +60 -0
- data/lib/ruby_client/HtmlResource.rb +34 -0
- data/lib/ruby_client/ImageInfo.rb +69 -0
- data/lib/ruby_client/ImageInformation.rb +57 -0
- data/lib/ruby_client/ImageInput.rb +150 -0
- data/lib/ruby_client/ImageResource.rb +89 -0
- data/lib/ruby_client/ImageResponse.rb +24 -0
- data/lib/ruby_client/Input.rb +53 -0
- data/lib/ruby_client/InputType.rb +41 -0
- data/lib/ruby_client/JsonResponse.rb +18 -0
- data/lib/ruby_client/LayoutDataResource.rb +48 -0
- data/lib/ruby_client/LineStyle.rb +79 -0
- data/lib/ruby_client/MergeOptions.rb +135 -0
- data/lib/ruby_client/MultiSelectListBoxInformation.rb +45 -0
- data/lib/ruby_client/Outline.rb +113 -0
- data/lib/ruby_client/OutlineList.rb +57 -0
- data/lib/ruby_client/OutlineStyle.rb +28 -0
- data/lib/ruby_client/OutputSize.rb +10 -0
- data/lib/ruby_client/PageInformation.rb +27 -0
- data/lib/ruby_client/PageInput.rb +152 -0
- data/lib/ruby_client/PageOrientation.rb +17 -0
- data/lib/ruby_client/PageSize.rb +127 -0
- data/lib/ruby_client/PageZoom.rb +33 -0
- data/lib/ruby_client/Pdf.rb +417 -0
- data/lib/ruby_client/PdfContent.rb +21 -0
- data/lib/ruby_client/PdfInfo.rb +68 -0
- data/lib/ruby_client/PdfInfoResponse.rb +27 -0
- data/lib/ruby_client/PdfInformation.rb +81 -0
- data/lib/ruby_client/PdfInput.rb +66 -0
- data/lib/ruby_client/PdfInstructions.rb +97 -0
- data/lib/ruby_client/PdfResource.rb +36 -0
- data/lib/ruby_client/PdfResponse.rb +23 -0
- data/lib/ruby_client/PdfText.rb +85 -0
- data/lib/ruby_client/PdfTextResponse.rb +27 -0
- data/lib/ruby_client/PdfXmp.rb +67 -0
- data/lib/ruby_client/PushButtonInformation.rb +21 -0
- data/lib/ruby_client/RC4128Security.rb +62 -0
- data/lib/ruby_client/Resource.rb +51 -0
- data/lib/ruby_client/ResourceType.rb +48 -0
- data/lib/ruby_client/Response.rb +39 -0
- data/lib/ruby_client/RgbColor.rb +1048 -0
- data/lib/ruby_client/Security.rb +73 -0
- data/lib/ruby_client/SecurityType.rb +23 -0
- data/lib/ruby_client/SignatureFieldInformation.rb +21 -0
- data/lib/ruby_client/Template.rb +46 -0
- data/lib/ruby_client/TextFieldInformation.rb +27 -0
- data/lib/ruby_client/TextReplace.rb +43 -0
- data/lib/ruby_client/UnitConverter.rb +111 -0
- data/lib/ruby_client/UrlAction.rb +31 -0
- data/lib/ruby_client/VAlign.rb +21 -0
- data/lib/ruby_client/WebColor.rb +18 -0
- data/lib/ruby_client/WordInput.rb +65 -0
- data/lib/ruby_client/WordResource.rb +82 -0
- data/lib/ruby_client/XmlResponse.rb +23 -0
- data/lib/ruby_client/version.rb +5 -0
- data/lib/ruby_client.rb +123 -0
- metadata +169 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
module DynamicPDFApi
|
2
|
+
require_relative 'Input'
|
3
|
+
require_relative 'DlexResource'
|
4
|
+
require_relative 'LayoutDataResource'
|
5
|
+
require_relative 'InputType'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Represents a Dlex input.
|
9
|
+
#
|
10
|
+
class DlexInput < Input
|
11
|
+
#
|
12
|
+
# Initializes a new instance of the DlexInput class by posting the DLEX file and the JSON data file from
|
13
|
+
# the client to the API to create the PDF report.
|
14
|
+
#
|
15
|
+
# @param dlex [String]|[DlexResource] The DLEX file path present in the resource manager or the DlexResource file created as per the desired PDF report layout design.
|
16
|
+
# @param layout [String]|[LayoutDataResource] The JSON data file path present in the resource manager used to create the PDF report or the LayoutDataResource file used to create the PDF report.
|
17
|
+
#
|
18
|
+
def initialize(dlex, layout)
|
19
|
+
super()
|
20
|
+
@_resources = []
|
21
|
+
@_type = InputType::DLEX
|
22
|
+
|
23
|
+
if (dlex.is_a?(String)) == true && layout.is_a?(String)
|
24
|
+
# super()
|
25
|
+
@resource_name = dlex
|
26
|
+
@layout_data_resource_name = layout
|
27
|
+
elsif (dlex.is_a?(String)) == true && layout.is_a?(Object)
|
28
|
+
@resource_name = dlex
|
29
|
+
@layout_data_resource_name = layout.layout_data_resource_name
|
30
|
+
@_resources << layout
|
31
|
+
elsif (dlex.is_a?(Object)) == true && layout.is_a?(Object)
|
32
|
+
@resource_name = dlex.resource_name
|
33
|
+
@layout_data_resource_name = layout.layout_data_resource_name
|
34
|
+
# dlex.LayoutDataResourceName=@LayoutDataResourceName
|
35
|
+
|
36
|
+
@_resources << layout
|
37
|
+
@_resources << dlex
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Gets or sets the name for layout data resource.
|
43
|
+
#
|
44
|
+
attr_accessor :layout_data_resource_name
|
45
|
+
|
46
|
+
def to_json(_options = {})
|
47
|
+
json_array = {}
|
48
|
+
json_array['type'] = 'dlex'
|
49
|
+
json_array['layoutDataResourceName'] = @layout_data_resource_name
|
50
|
+
|
51
|
+
#---------------------------------------------------
|
52
|
+
json_array['templateId'] = @_template_id unless @_template_id.nil?
|
53
|
+
|
54
|
+
json_array['resourceName'] = @resource_name unless @resource_name.nil?
|
55
|
+
|
56
|
+
json_array['id'] = @id unless @id.nil?
|
57
|
+
|
58
|
+
JSON.pretty_generate(json_array)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
module DynamicPDFApi
|
2
|
+
require_relative 'Endpoint'
|
3
|
+
require_relative 'AdditionalResource'
|
4
|
+
|
5
|
+
class DlexLayout < Endpoint
|
6
|
+
#
|
7
|
+
# Initializes a new instance of the DlexLayout class using the DLEX file path present in the cloud environment
|
8
|
+
# and the JSON data for the PDF report.
|
9
|
+
#
|
10
|
+
# @param cloud_dlex_path [String] The DLEX file path present in the resource manager.
|
11
|
+
# @param layout_data [LayoutDataResource] The LayoutDataResource, json data file used to create the PDF report.
|
12
|
+
#
|
13
|
+
def initialize(dlex, layout)
|
14
|
+
@_endpoint_name = 'dlex-layout'
|
15
|
+
@resources= []
|
16
|
+
super()
|
17
|
+
if(dlex.is_a?(String)) == true && layout.is_a?(Object)
|
18
|
+
@dlex_path = dlex
|
19
|
+
@resource = layout
|
20
|
+
elsif (dlex.is_a?(Object)) == true && layout.is_a?(Object)
|
21
|
+
@resources << dlex
|
22
|
+
@resource = layout
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Adds additional resource to the endpoint.
|
28
|
+
#
|
29
|
+
# <param name="resourcePath">The resource file path.
|
30
|
+
# <param name="resourceName">The name of the resource.
|
31
|
+
def add_additional_resource(resourcePath, resourceName = nil)
|
32
|
+
|
33
|
+
resourceName = File.basename(resourcePath) if !resourceName.nil?
|
34
|
+
|
35
|
+
additional_resource = AdditionalResource.new(resourcePath, resourceName)
|
36
|
+
|
37
|
+
if additional_resource.type == ResourceType::LAYOUT_DATA
|
38
|
+
raise 'Layout data resources cannot be added to a DlexLayout object.'
|
39
|
+
elsif additional_resource.type == ResourceType::DLEX
|
40
|
+
raise 'Dlex resources cannot be added to a DlexLayout object.'
|
41
|
+
else
|
42
|
+
@resources << additional_resource
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_additional_resource_with_resourcedata(resourceData, additionalResourceType, resourceName)
|
48
|
+
type = ResourceType::PDF
|
49
|
+
case (additionalResourceType)
|
50
|
+
|
51
|
+
when AdditionalResourceType::FONT
|
52
|
+
type = ResourceType::FONT
|
53
|
+
when AdditionalResourceType::IMAGE
|
54
|
+
type = ResourceType::IMAGE
|
55
|
+
when AdditionalResourceType::PDF
|
56
|
+
type = ResourceType::PDF
|
57
|
+
else
|
58
|
+
raise 'This type of resource not allowed'
|
59
|
+
end
|
60
|
+
additional_resource = AdditionalResource.new(resourceData, resourceName, type)
|
61
|
+
@resources << additional_resource
|
62
|
+
end
|
63
|
+
|
64
|
+
attr_accessor :resources
|
65
|
+
|
66
|
+
attr_accessor :resource
|
67
|
+
|
68
|
+
#
|
69
|
+
# Gets or sets the DLEX file path present in the resource manager.
|
70
|
+
#
|
71
|
+
attr_accessor :dlex_path
|
72
|
+
|
73
|
+
#
|
74
|
+
# Process the DLEX and layout data to create PDF report.
|
75
|
+
#
|
76
|
+
# @return PdfResponse Returns collection of PdfResponse tasks.
|
77
|
+
#
|
78
|
+
def process
|
79
|
+
header = {
|
80
|
+
'Authorization': "Bearer #{@api_key}",
|
81
|
+
'Expect': '100-continue'
|
82
|
+
}
|
83
|
+
|
84
|
+
uri = URI.parse("#{@base_url}/v1.0/#{@_endpoint_name}")
|
85
|
+
resource_array = []
|
86
|
+
|
87
|
+
resource_array << ['LayoutData', @resource.data, { content_type: @resource._mime_type, filename: @resource.layout_data_resource_name }] if !@resource.nil?
|
88
|
+
|
89
|
+
resource_array << ['DlexPath', @dlex_path,
|
90
|
+
{ content_type: 'application/octet-stream', filename: '' }] if !@dlex_path.nil?
|
91
|
+
@resources.each { |field|
|
92
|
+
data = if !field._file_path.nil?
|
93
|
+
File.binread(field._file_path)
|
94
|
+
else
|
95
|
+
field.data
|
96
|
+
end
|
97
|
+
|
98
|
+
resource_array << ["Resource", data,
|
99
|
+
{ content_type: "application/octet-stream", filename: field.resource_name }]
|
100
|
+
}
|
101
|
+
|
102
|
+
request = Net::HTTP::Post.new(uri.request_uri, header)
|
103
|
+
|
104
|
+
req_options = {
|
105
|
+
use_ssl: uri.scheme == 'https',
|
106
|
+
verify_mode: OpenSSL::SSL::VERIFY_NONE
|
107
|
+
}
|
108
|
+
|
109
|
+
request.set_form(resource_array, 'multipart/form-data')
|
110
|
+
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
|
111
|
+
http.request(request)
|
112
|
+
end
|
113
|
+
ret_object = PdfResponse.new
|
114
|
+
ret_object.is_successful = false
|
115
|
+
ret_object.status_code = response.code
|
116
|
+
out_data = response.body
|
117
|
+
|
118
|
+
if !ret_object.nil? && ret_object.status_code == '200' && out_data[0, 4].eql?('%PDF') == true
|
119
|
+
ret_object = PdfResponse.new(out_data)
|
120
|
+
ret_object.is_successful = true
|
121
|
+
else
|
122
|
+
out_data_json = JSON.parse(out_data)
|
123
|
+
ret_object.error_json = out_data
|
124
|
+
ret_object.error_message = if !out_data_json['message'].nil?
|
125
|
+
out_data_json['message']
|
126
|
+
else
|
127
|
+
"status_code : #{Net::HTTPResponse::CODE_TO_OBJ[ret_object.status_code]}"
|
128
|
+
end
|
129
|
+
ret_object.error_id = out_data_json['id']
|
130
|
+
end
|
131
|
+
|
132
|
+
ret_object
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module DynamicPDFApi
|
2
|
+
require_relative 'Resource'
|
3
|
+
require_relative 'ResourceType'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Represents a Dlex resource object that is created using the DLEX file and a name.
|
7
|
+
#
|
8
|
+
class DlexResource < Resource
|
9
|
+
#
|
10
|
+
# Initializes a new instance of the DlexResource class with DLEX file path and resource name as parameters.
|
11
|
+
#
|
12
|
+
# @param dlex [String]|[Array]|[Stream] The dlex file path or the byte array of the dlex file or the stream of the dlex file.
|
13
|
+
# @param resource_name [String] The name of the resource.
|
14
|
+
#
|
15
|
+
def initialize(dlex, resource_name = nil)
|
16
|
+
@layout_data_resource_name = nil
|
17
|
+
@_type = ResourceType::DLEX
|
18
|
+
@_mime_type = 'application/xml'
|
19
|
+
super(dlex, resource_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
def _file_extension
|
23
|
+
'.dlex'
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Gets or sets name for layout data resource.
|
28
|
+
#
|
29
|
+
attr_accessor :layout_data_resource_name
|
30
|
+
|
31
|
+
def to_json(_options = {})
|
32
|
+
json_array = {}
|
33
|
+
json_array['type'] = 'dlex'
|
34
|
+
|
35
|
+
json_array['layoutDataResourceName'] = @layout_data_resource_name
|
36
|
+
json_array['resourceName'] = @resource_name
|
37
|
+
JSON.pretty_generate(json_array)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# Ruby client api namespace
|
2
|
+
module DynamicPDFApi
|
3
|
+
require_relative "Element"
|
4
|
+
require_relative "ElementType"
|
5
|
+
require_relative "AztecSymbolSize"
|
6
|
+
require_relative "BarcodeElement"
|
7
|
+
require_relative "Dim2BarcodeElement"
|
8
|
+
|
9
|
+
#
|
10
|
+
# Represents an Aztec barcode element.
|
11
|
+
#
|
12
|
+
# With some of the .Net runtime (example: .Net Core 2.0) the ECI values 20, 28, 29 and 30 will give the
|
13
|
+
# error 'No data is available for encoding 'code page number'. For information on defining a custom encoding,
|
14
|
+
# see the documentation for the Encoding.RegisterProvider method.'.
|
15
|
+
#
|
16
|
+
class AztecBarcodeElement < Dim2BarcodeElement
|
17
|
+
#
|
18
|
+
# Initializes a new instance of the AztecBarcodeElement class.
|
19
|
+
#
|
20
|
+
# @param value [String]|[array] The value of the barcode either as string or byte array.
|
21
|
+
# @param placement [String] The placement of the barcode on the page.
|
22
|
+
# @param x_offset [float] The X coordinate of the barcode.
|
23
|
+
# @param y_offset [float] The Y coordinate of the barcode.
|
24
|
+
#
|
25
|
+
def initialize(value, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
|
26
|
+
@_type = ElementType::AZTEC_BARCODE
|
27
|
+
@process_tilde = false
|
28
|
+
@symbol_size = nil
|
29
|
+
@aztec_error_correction = 0
|
30
|
+
@reader_initialization_symbol = false
|
31
|
+
super(value, placement, x_offset, y_offset)
|
32
|
+
end
|
33
|
+
|
34
|
+
attr_accessor :type
|
35
|
+
|
36
|
+
#
|
37
|
+
# Gets or Sets a boolean indicating whether to process tilde symbol in the input.
|
38
|
+
#
|
39
|
+
# Setting true will check for ~ character and processes it for FNC1 or ECI characters. With some of the
|
40
|
+
# .Net runtime (example: .Net Core 2.0), the ECI values 20, 28, 29 and 30 will give the error 'No data
|
41
|
+
# is available for encoding 'code page number'. For information on defining a custom encoding, see the
|
42
|
+
# documentation for the Encoding.RegisterProvider method.'.
|
43
|
+
#
|
44
|
+
#
|
45
|
+
attr_accessor :process_tilde
|
46
|
+
|
47
|
+
#
|
48
|
+
# Gets or Sets the barcode size, AztecSymbolSize.
|
49
|
+
#
|
50
|
+
attr_accessor :symbol_size
|
51
|
+
|
52
|
+
#
|
53
|
+
# Gets or Sets the error correction value.
|
54
|
+
#
|
55
|
+
# Error correction value may be between 5% to 95%.
|
56
|
+
#
|
57
|
+
attr_accessor :aztec_error_correction
|
58
|
+
|
59
|
+
#
|
60
|
+
# Gets or Sets a boolean representing if the barcode is a reader initialization symbol.
|
61
|
+
#
|
62
|
+
# Setting true will mark the symbol as reader initialization symbol and the size of the symbol should be
|
63
|
+
# one of the following, R15xC15 Compact, R19xC19, R23xC23, R27xC27, R31xC31, R37xC37, R41xC41, R45xC45,
|
64
|
+
# R49xC49, R53xC53, R57xC57, R61xC61, R67xC67, R71xC71, R75xC75, R79xC79, R83xC83, R87xC87, R91xC91, R95xC95,
|
65
|
+
# R101xC101, R105xC105, R109xC109, however it is recommended to set Auto.
|
66
|
+
#
|
67
|
+
attr_accessor :reader_initialization_symbol
|
68
|
+
|
69
|
+
def to_json(_options = {})
|
70
|
+
json_array = {}
|
71
|
+
|
72
|
+
json_array["type"] = "aztecBarcode"
|
73
|
+
|
74
|
+
# if(@processTilde != nil)
|
75
|
+
json_array["processTilde"] = @process_tilde
|
76
|
+
|
77
|
+
json_array["symbolSize"] = @symbol_size unless @symbol_size.nil?
|
78
|
+
|
79
|
+
json_array["aztecErrorCorrection"] = @aztec_error_correction unless @aztec_error_correction.nil?
|
80
|
+
|
81
|
+
# if(@reader_initialization_symbol != nil)
|
82
|
+
json_array["readerInitializationSymbol"] = @reader_initialization_symbol
|
83
|
+
|
84
|
+
#--------------Dim2BarcodeElement------------------------------
|
85
|
+
|
86
|
+
json_array["valueType"] = @_value_type unless @_value_type.nil?
|
87
|
+
|
88
|
+
#----------------barcodeElement--------------------------------
|
89
|
+
|
90
|
+
json_array["color"] = @color._color_string if !@color.nil? && !@color._color_string.nil?
|
91
|
+
|
92
|
+
json_array["xDimension"] = @x_dimension unless @x_dimension.nil?
|
93
|
+
|
94
|
+
json_array["value"] = @value unless @value.nil?
|
95
|
+
|
96
|
+
# ------------element---------------------
|
97
|
+
|
98
|
+
json_array["placement"] = @placement unless @placement.nil?
|
99
|
+
|
100
|
+
json_array["xOffset"] = @x_offset unless @x_offset.nil?
|
101
|
+
|
102
|
+
json_array["yOffset"] = @y_offset unless @y_offset.nil?
|
103
|
+
|
104
|
+
# if(@even_pages != nil)
|
105
|
+
json_array["evenPages"] = @even_pages
|
106
|
+
|
107
|
+
# if(@odd_pages != nil)
|
108
|
+
json_array["oddPages"] = @odd_pages
|
109
|
+
|
110
|
+
JSON.pretty_generate(json_array)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
module DynamicPDFApi
|
2
|
+
#
|
3
|
+
# Represents Aztec symbol sizes.
|
4
|
+
#
|
5
|
+
class AztecSymbolSize
|
6
|
+
#
|
7
|
+
# Size auto.
|
8
|
+
#
|
9
|
+
AUTO = "auto".freeze
|
10
|
+
|
11
|
+
#
|
12
|
+
# Full size Aztec.
|
13
|
+
#
|
14
|
+
FULL = "full".freeze
|
15
|
+
|
16
|
+
#
|
17
|
+
# Compact size Aztec.
|
18
|
+
#
|
19
|
+
COMPACT = "compact".freeze
|
20
|
+
|
21
|
+
#
|
22
|
+
# Aztec Runes.
|
23
|
+
#
|
24
|
+
RUNE = "rune".freeze
|
25
|
+
|
26
|
+
#
|
27
|
+
# 15 rows by 15 columns, Compact size.
|
28
|
+
#
|
29
|
+
R15_X_C15_COMPACT = "r15xC15Compact".freeze
|
30
|
+
|
31
|
+
#
|
32
|
+
# 19 rows by 19 columns, Compact size.
|
33
|
+
#
|
34
|
+
R19_X_C19_COMPACT = "r19xC19Compact".freeze
|
35
|
+
|
36
|
+
#
|
37
|
+
# 19 rows by 19 columns.
|
38
|
+
#
|
39
|
+
R19_X_C19 = "r19xC19".freeze
|
40
|
+
|
41
|
+
#
|
42
|
+
# 23 rows by 23 columns, Compact size.
|
43
|
+
#
|
44
|
+
R23_X_C23_COMPACT = "r23xC23Compact".freeze
|
45
|
+
|
46
|
+
#
|
47
|
+
# 23 rows by 23 columns.
|
48
|
+
#
|
49
|
+
R23_X_C23 = "r23xC23".freeze
|
50
|
+
|
51
|
+
#
|
52
|
+
# 27 rows by 27 columns, Compact size.
|
53
|
+
#
|
54
|
+
R27_X_C27_COMPACT = "r27xC27Compact".freeze
|
55
|
+
|
56
|
+
#
|
57
|
+
# 27 rows by 27 columns.
|
58
|
+
#
|
59
|
+
R27_X_C27 = "r27xC27".freeze
|
60
|
+
|
61
|
+
#
|
62
|
+
# 31 rows by 31 Column.
|
63
|
+
#
|
64
|
+
R31_X_C31 = "r31xC31".freeze
|
65
|
+
|
66
|
+
#
|
67
|
+
# 37 rows by 37 columns.
|
68
|
+
#
|
69
|
+
R37_X_C37 = "r37xC37".freeze
|
70
|
+
|
71
|
+
#
|
72
|
+
# 41 rows by 41 columns.
|
73
|
+
#
|
74
|
+
R41_X_C41 = "r41xC41".freeze
|
75
|
+
|
76
|
+
#
|
77
|
+
# 45 rows by 45 columns.
|
78
|
+
#
|
79
|
+
R45_X_C45 = "r45xC45".freeze
|
80
|
+
|
81
|
+
#
|
82
|
+
# 49 rows by 49 columns.
|
83
|
+
#
|
84
|
+
R49_X_C49 = "r49xC49".freeze
|
85
|
+
|
86
|
+
#
|
87
|
+
# 53 rows by 53 columns.
|
88
|
+
#
|
89
|
+
R53_X_C53 = "r53xC53".freeze
|
90
|
+
|
91
|
+
#
|
92
|
+
# 57 rows by 57 columns.
|
93
|
+
#
|
94
|
+
R57_X_C57 = "r57xC57".freeze
|
95
|
+
|
96
|
+
#
|
97
|
+
# 61 rows by 61 columns.
|
98
|
+
#
|
99
|
+
R61_X_C61 = "r61xC61".freeze
|
100
|
+
|
101
|
+
#
|
102
|
+
# 67 rows by 67 columns.
|
103
|
+
#
|
104
|
+
R67_X_C67 = "r67xC67".freeze
|
105
|
+
|
106
|
+
#
|
107
|
+
# 71 rows by 71 columns.
|
108
|
+
#
|
109
|
+
R71_X_C71 = "r71xC71".freeze
|
110
|
+
|
111
|
+
#
|
112
|
+
# 75 rows by 75 columns.
|
113
|
+
#
|
114
|
+
R75_X_C75 = "r75xC75".freeze
|
115
|
+
|
116
|
+
#
|
117
|
+
# 79 rows by 79 columns.
|
118
|
+
#
|
119
|
+
R79_X_C79 = "r79xC79".freeze
|
120
|
+
|
121
|
+
#
|
122
|
+
# 83 rows by 83 columns.
|
123
|
+
#
|
124
|
+
R83_X_C83 = "r83xC83".freeze
|
125
|
+
|
126
|
+
#
|
127
|
+
# 87 rows by 87 columns.
|
128
|
+
#
|
129
|
+
R87_X_C87 = "r87xC87".freeze
|
130
|
+
|
131
|
+
#
|
132
|
+
# 91 rows by 91 columns.
|
133
|
+
#
|
134
|
+
R91_X_C91 = "r91xC91".freeze
|
135
|
+
|
136
|
+
#
|
137
|
+
# 95 rows by 95 columns.
|
138
|
+
#
|
139
|
+
R95_X_C95 = "r95xC95".freeze
|
140
|
+
|
141
|
+
#
|
142
|
+
# 101 rows by 101 columns.
|
143
|
+
#
|
144
|
+
R101_X_C101 = "r101xC101".freeze
|
145
|
+
|
146
|
+
#
|
147
|
+
# 105 rows by 105 columns.
|
148
|
+
#
|
149
|
+
R105_X_C105 = "r105xC105".freeze
|
150
|
+
|
151
|
+
#
|
152
|
+
# 109 rows by 109 columns.
|
153
|
+
#
|
154
|
+
R109_X_C109 = "r109xC109".freeze
|
155
|
+
|
156
|
+
#
|
157
|
+
# 113 rows by 113 columns.
|
158
|
+
#
|
159
|
+
R113_X_C113 = "r113xC113".freeze
|
160
|
+
|
161
|
+
#
|
162
|
+
# 117 rows by 117 columns.
|
163
|
+
#
|
164
|
+
R117_X_C117 = "r117xC117".freeze
|
165
|
+
|
166
|
+
#
|
167
|
+
# 121 rows by 121 columns.
|
168
|
+
#
|
169
|
+
R121_X_C121 = "r121xC121".freeze
|
170
|
+
|
171
|
+
#
|
172
|
+
# 125 rows by 125 columns.
|
173
|
+
#
|
174
|
+
R125_X_C125 = "r125xC125".freeze
|
175
|
+
|
176
|
+
#
|
177
|
+
# 131 rows by 131 columns.
|
178
|
+
#
|
179
|
+
R131_X_C131 = "r131xC131".freeze
|
180
|
+
|
181
|
+
#
|
182
|
+
# 135 rows by 135 columns.
|
183
|
+
#
|
184
|
+
R135_X_C135 = "r135xC135".freeze
|
185
|
+
|
186
|
+
#
|
187
|
+
# 139 rows by 139 columns.
|
188
|
+
#
|
189
|
+
R139_X_C139 = "r139xC139".freeze
|
190
|
+
|
191
|
+
#
|
192
|
+
# 143 rows by 143 columns.
|
193
|
+
#
|
194
|
+
R143_X_C143 = "r143xC143".freeze
|
195
|
+
|
196
|
+
#
|
197
|
+
# 147 rows by 147 columns.
|
198
|
+
#
|
199
|
+
R147_X_C147 = "r147xC147".freeze
|
200
|
+
|
201
|
+
#
|
202
|
+
# 151 rows by 151 columns.
|
203
|
+
#
|
204
|
+
R151_X_C151 = "r151xC151".freeze
|
205
|
+
end
|
206
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module DynamicPDFApi
|
2
|
+
require_relative "Element"
|
3
|
+
require_relative "ElementPlacement"
|
4
|
+
|
5
|
+
#
|
6
|
+
# Base class from which barcode page elements are derived.
|
7
|
+
#
|
8
|
+
class BarcodeElement < Element
|
9
|
+
def initialize(value, placement, x_offset, y_offset)
|
10
|
+
@color = nil
|
11
|
+
@x_dimension = nil
|
12
|
+
|
13
|
+
super(value, placement, x_offset, y_offset)
|
14
|
+
@value = value
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_accessor :_color_name
|
18
|
+
|
19
|
+
#
|
20
|
+
# Gets or sets the Color of the barcode.
|
21
|
+
#
|
22
|
+
def color=(color_value)
|
23
|
+
@color = color_value
|
24
|
+
@_color_name = @color._color_string
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Gets or sets the XDimension of the barcode.
|
29
|
+
#
|
30
|
+
attr_accessor :x_dimension
|
31
|
+
|
32
|
+
#
|
33
|
+
# Gets or sets the value of the barcode.
|
34
|
+
#
|
35
|
+
attr_accessor :value
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module DynamicPDFApi
|
2
|
+
require_relative "TextBarcodeElement"
|
3
|
+
require_relative "ElementPlacement"
|
4
|
+
require_relative "ElementType"
|
5
|
+
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# Represents a Code 11 barcode element.
|
9
|
+
#
|
10
|
+
# This class can be used to place a Code 11 barcode on a page.
|
11
|
+
#
|
12
|
+
#
|
13
|
+
class Code11BarcodeElement < TextBarcodeElement
|
14
|
+
#
|
15
|
+
# Initializes a new instance of the Code11BarcodeElement class.
|
16
|
+
#
|
17
|
+
# @param value [String] The value of the barcode.
|
18
|
+
# @param placement [String] The placement of the barcode on the page.
|
19
|
+
# @param height [float] The height of the barcode.
|
20
|
+
# @param x_offset [float] The X coordinate of the barcode.
|
21
|
+
# @param y_offset [float] The Y coordinate of the barcode.
|
22
|
+
#
|
23
|
+
def initialize(value, height, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
|
24
|
+
@_type = ElementType::CODE11_BARCODE
|
25
|
+
super(value, placement, x_offset, y_offset)
|
26
|
+
@height = height
|
27
|
+
end
|
28
|
+
|
29
|
+
attr_accessor :_type
|
30
|
+
|
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"] = "code11Barcode"
|
40
|
+
|
41
|
+
json_array["height"] = @height unless @height.nil?
|
42
|
+
|
43
|
+
#----------------TextBarcodeElement---------------------------------
|
44
|
+
json_array["font"] = @_font_name unless @_font_name.nil?
|
45
|
+
|
46
|
+
json_array["textColor"] = @text_color._color_string if !@text_color.nil? && !@text_color._color_string.nil?
|
47
|
+
|
48
|
+
json_array["fontSize"] = @font_size unless @font_size.nil?
|
49
|
+
|
50
|
+
json_array["showText"] = @show_text if @show_text != "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(@evenPages != nil)
|
69
|
+
json_array["evenPages"] = @even_pages
|
70
|
+
|
71
|
+
# if(@oddPages != nil)
|
72
|
+
json_array["oddPages"] = @odd_pages
|
73
|
+
|
74
|
+
JSON.pretty_generate(json_array)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|