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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 31198d3de33783aad8586d0ee95f309d76af7692a8282071e2c249335ba4773b
4
+ data.tar.gz: 8916af160d00fbe67d079503948d1823b7c87bb62012e9ce8c316abc4bb291fc
5
+ SHA512:
6
+ metadata.gz: c861c279b7312834a3f5825eb9a671117d661d7cf430dd648272af99e5b5864c93e435f9ea04d4983fa2e82cc9f93a5ea70353954fd607baa6c7fb19370af7a5
7
+ data.tar.gz: 010eb606bc82330b73d1974cfca97aaaf21480cdd8e6b674948b499180f5d7af466bfbeca60c50b74c82b55c9fb6e47a6d0ae5629788157585841c7fb943b84c
@@ -0,0 +1,15 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Base class representing an action to perform tasks in many places such as in outlines, links, buttons
4
+ # etc.
5
+ #
6
+ # UrlAction and GoToAction are derived from Action.
7
+ #
8
+ class Action
9
+ def initialize; end
10
+
11
+ def to_json(_options = {})
12
+ JSON.pretty_generate({})
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,113 @@
1
+ module DynamicPDFApi
2
+
3
+ require_relative 'AdditionalResourceType'
4
+
5
+ class AdditionalResource < Resource
6
+ def initialize(resource, resource_name, resource_type=nil)
7
+ @default_page_height = 792.0
8
+ @default_page_width = 612.0
9
+ @type = ResourceType::LAYOUT_DATA
10
+
11
+ if (resource.is_a?(Array)) == true
12
+ super(resource, resource_name)
13
+ @type = resource_type
14
+ else
15
+ super(resource, resource_name)
16
+ @type = get_resource_type(resource)
17
+ end
18
+ end
19
+
20
+ def get_resource_type(resourcePath)
21
+ @type = ResourceType::PDF
22
+ file_extension = File.extname(resourcePath).downcase
23
+ case (file_extension)
24
+
25
+ when ".pdf"
26
+ @type = ResourceType::PDF
27
+
28
+ when ".dlex"
29
+ @type = ResourceType::DLEX
30
+
31
+ when ".json"
32
+ @type = ResourceType::LAYOUT_DATA
33
+
34
+ when ".ttf"
35
+ when ".otf"
36
+ @type = ResourceType::FONT
37
+
38
+ when ".tiff"
39
+ @type = ResourceType::IMAGE
40
+ when ".tif"
41
+ @type = ResourceType::IMAGE
42
+ when ".png"
43
+ @type = ResourceType::IMAGE
44
+ when ".gif"
45
+ @type = ResourceType::IMAGE
46
+ when ".jpeg"
47
+ @type = ResourceType::IMAGE
48
+ when ".jpg"
49
+ @type = ResourceType::IMAGE
50
+ when ".bmp"
51
+ @type = ResourceType::IMAGE
52
+
53
+ when ".html"
54
+ @type = ResourceType::HTML
55
+
56
+ end
57
+ @type
58
+ end
59
+
60
+ def file_extension=(value)
61
+ @file_extension = value
62
+ case (@type)
63
+
64
+ when ResourceType::IMAGE
65
+ @file_header = @data[0, 16]
66
+ @file_header = @file_header.bytes
67
+ if (ImageResource.is_png_image(@file_header))
68
+ @_mime_type = "image/png"
69
+ elsif (ImageResource.is_jpeg_image(@file_header))
70
+ @_mime_type = "image/jpeg"
71
+ elsif (ImageResource.is_gif_image(@file_header))
72
+ @_mime_type = "image/gif"
73
+ elsif (ImageResource.is_tiff_image(@file_header))
74
+ @_mime_type = "image/tiff"
75
+ elsif (ImageResource.is_jpeg2000_image(@file_header))
76
+ @_mime_type = "image/jpeg"
77
+ elsif (ImageResource.is_valid_bitmap_image(@file_header))
78
+ @_mime_type = "image/bmp"
79
+ else
80
+ raise "Not supported image type or invalid image."
81
+ end
82
+ when ResourceType::PDF
83
+ @_mime_type = "application/pdf"
84
+ ".pdf"
85
+ when ResourceType::LAYOUT_DATA
86
+ @_mime_type = "application/json"
87
+ ".json"
88
+ when ResourceType::DLEX
89
+ @_mime_type = "application/xml"
90
+ ".dlex"
91
+ when ResourceType::FONT
92
+ if (Data[0] == 0x4f && Data[1] == 0x54 && Data[2] == 0x54 && Data[3] == 0x4f)
93
+ @_mime_type = "font/otf"
94
+ ".otf"
95
+ elsif (Data[0] == 0x00 && Data[1] == 0x01 && Data[2] == 0x00 && Data[3] == 0x00)
96
+ @_mime_type = "font/ttf"
97
+ ".ttf"
98
+ else
99
+ raise "Unsupported font"
100
+ end
101
+ when ResourceType::Html
102
+ @_mime_type = "text/html"
103
+ ".html"
104
+ end
105
+ nil
106
+ end
107
+
108
+ attr_accessor :type
109
+ attr_accessor :_mime_type
110
+ attr_accessor :default_page_height
111
+ attr_accessor :default_page_width
112
+ end
113
+ end
@@ -0,0 +1,27 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies additional resource type.
4
+ #
5
+ class AdditionalResourceType
6
+
7
+ #
8
+ # Image resource.
9
+ #
10
+ IMAGE = "Image".freeze
11
+
12
+ #
13
+ # Pdf resource.
14
+ #
15
+ PDF = "Pdf".freeze
16
+
17
+ #
18
+ # Font resource.
19
+ #
20
+ FONT = "Font".freeze
21
+
22
+ #
23
+ # Html resource.
24
+ #
25
+ HTML = "Html".freeze
26
+ end
27
+ end
@@ -0,0 +1,70 @@
1
+ module DynamicPDFApi
2
+ require_relative 'SecurityType'
3
+ require_relative 'EncryptDocumentComponents'
4
+ require_relative 'Security'
5
+
6
+ #
7
+ # Represents AES 128 bit PDF document security.
8
+ #
9
+ # AES 128 bit PDF security is compatible with PDF version 1.5 and higher and, Adobe Acrobat Reader version
10
+ # 7 or higher is needed to open these documents. Older readers will not be able to read documents encrypted
11
+ # with this security.
12
+ #
13
+ class Aes128Security < Security
14
+ #
15
+ # Initializes a new instance of the Aes128Security class by taking the owner and user passwords as parameters
16
+ # to create PDF.
17
+ #
18
+ # @param user_password [String] The user password to open the document.
19
+ # @param owner_password [String] The owner password to open the document.
20
+ #
21
+ def initialize(user_password, owner_password)
22
+ @document_components = nil
23
+ @_type = SecurityType::AES_128
24
+ super(user_password, owner_password)
25
+
26
+ end
27
+
28
+ #
29
+ # Gets or sets the EncryptDocumentComponents, components of the document to be encrypted. We can encrypt
30
+ # all the PDF content or the content, excluding the metadata.
31
+ #
32
+ attr_accessor :document_components
33
+
34
+ def to_json(_options = {})
35
+ json_array = {}
36
+ json_array['type'] = 'aes128'
37
+
38
+ json_array['documentComponents'] = @document_components.downcase unless @document_components.nil?
39
+
40
+ #-------------------------------------------
41
+ json_array['allowCopy'] = @allow_copy unless @allow_copy.nil?
42
+
43
+ json_array['allowEdit'] = @allow_edit unless @allow_edit.nil?
44
+
45
+ json_array['allowPrint'] = @allow_print unless @allow_print.nil?
46
+
47
+ unless @allow_update_annots_and_fields.nil?
48
+ json_array['allowUpdateAnnotsAndFields'] =
49
+ @allow_update_annots_and_fields
50
+ end
51
+
52
+ json_array['ownerPassword'] = @owner_password unless @owner_password.nil?
53
+
54
+ json_array['userPassword'] = @user_password unless @user_password.nil?
55
+
56
+ json_array['allowAccessibility'] = @allow_accessibility unless @allow_accessibility.nil?
57
+
58
+ json_array['allowFormFilling'] = @allow_form_filling unless @allow_form_filling.nil?
59
+
60
+ unless @allow_high_resolution_printing.nil?
61
+ json_array['allowHighResolutionPrinting'] =
62
+ @allow_high_resolution_printing
63
+ end
64
+
65
+ json_array['allowDocumentAssembly'] = @allow_document_assembly unless @allow_document_assembly.nil?
66
+
67
+ JSON.pretty_generate(json_array)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,70 @@
1
+ module DynamicPDFApi
2
+ require_relative 'SecurityType'
3
+ require_relative 'EncryptDocumentComponents'
4
+ require_relative 'Security'
5
+
6
+ #
7
+ #
8
+ # Represents AES 256 bit PDF document security.
9
+ #
10
+ # AES 256 bit PDF security is compatible with PDF version 1.5 and higher. This class is FIPS compliant
11
+ # when used in applications targeting .NET framework v3.5 or higher. Adobe Acrobat Reader version X or
12
+ # higher is needed to open these documents.
13
+ #
14
+ class Aes256Security < Security
15
+ #
16
+ # Initializes a new instance of the Aes256Security class by taking the owner and user passwords as parameters
17
+ # to create PDF.
18
+ #
19
+ # @param owner_password [String] The owner password to open the document.
20
+ # @param user_password [String] The user password to open the document.
21
+ #
22
+ def initialize(user_password, owner_password)
23
+ @document_components = nil
24
+ @_type = SecurityType::AES_256
25
+ super(user_password, owner_password)
26
+ end
27
+
28
+ #
29
+ # Gets or sets the EncryptDocumentComponents, components of the document to be encrypted. We can encrypt
30
+ # all the PDF content or the content, excluding the metadata.
31
+ #
32
+ attr_accessor :document_components
33
+
34
+ def to_json(_options = {})
35
+ json_array = {}
36
+ json_array['type'] = 'aes256'
37
+
38
+ json_array['documentComponents'] = @document_components.downcase unless @document_components.nil?
39
+
40
+ #-------------------------------------------
41
+ json_array['allowCopy'] = @allow_copy unless @allow_copy.nil?
42
+
43
+ json_array['allowEdit'] = @allow_edit unless @allow_edit.nil?
44
+
45
+ json_array['allowPrint'] = @allow_print unless @allow_print.nil?
46
+
47
+ unless @allow_update_annots_and_fields.nil?
48
+ json_array['allowUpdateAnnotsAndFields'] =
49
+ @allow_update_annots_and_fields
50
+ end
51
+
52
+ json_array['ownerPassword'] = @owner_password unless @owner_password.nil?
53
+
54
+ json_array['userPassword'] = @user_password unless @user_password.nil?
55
+
56
+ json_array['allowAccessibility'] = @allow_accessibility unless @allow_accessibility.nil?
57
+
58
+ json_array['allowFormFilling'] = @allow_form_filling unless @allow_form_filling.nil?
59
+
60
+ unless @allow_high_resolution_printing.nil?
61
+ json_array['allowHighResolutionPrinting'] =
62
+ @allow_high_resolution_printing
63
+ end
64
+
65
+ json_array['allowDocumentAssembly'] = @allow_document_assembly unless @allow_document_assembly.nil?
66
+
67
+ JSON.pretty_generate(json_array)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,21 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies horizontal alignment. Center alignment is the default value for alignments.
4
+ #
5
+ class Align
6
+ #
7
+ # Align left.
8
+ #
9
+ LEFT = 'left'.freeze
10
+
11
+ #
12
+ # Align center. This is default.
13
+ #
14
+ CENTER = 'center'.freeze
15
+
16
+ #
17
+ # Align right.
18
+ #
19
+ RIGHT = 'right'.freeze
20
+ end
21
+ end
@@ -0,0 +1,48 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents information of a button field.
4
+ #
5
+ class ButtonFieldInformation
6
+ def initialize
7
+ @name = nil
8
+ @_type = nil
9
+ @value = nil
10
+ @default_value = nil
11
+ @export_value = nil
12
+ @export_values = {}
13
+ end
14
+
15
+ #
16
+ # Gets or Sets the name of the button field.
17
+ #
18
+ attr_accessor :name
19
+
20
+ #
21
+ # Gets or sets the type of the button field, ex: RadioButton, CheckBox etc.
22
+ #
23
+ attr_accessor :type
24
+
25
+ #
26
+ # Gets or sets the value of the button field.
27
+ #
28
+ attr_accessor :value
29
+
30
+ #
31
+ # Gets or Sets the default value of the button field.
32
+ #
33
+ attr_accessor :default_value
34
+
35
+ #
36
+ # Gets or Sets the export value. These values will be exported when submitting the form.
37
+ #
38
+ # To create a set of mutually exclusive radio buttons (i.e., where only one can be selected at a time),
39
+ # create the fields with the same name but different export values.
40
+ #
41
+ attr_accessor :export_value
42
+
43
+ #
44
+ # Gets the collection of export value.
45
+ #
46
+ attr_accessor :export_values
47
+ end
48
+ end
@@ -0,0 +1,16 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies the type of a button field.
4
+ #
5
+ class ButtonFieldType
6
+ #
7
+ # Represents a Radio Button.
8
+ #
9
+ RADIO_BUTTON = 'radioButton'.freeze
10
+
11
+ #
12
+ # Represents a Checkbox.
13
+ #
14
+ CHECK_BOX = 'checkBox'.freeze
15
+ end
16
+ end
@@ -0,0 +1,52 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Represents the information of a choice field in interactive forms. A choice field contains several text
4
+ # items, one or more of which may be selected as the field value.
5
+ #
6
+ class ChoiceFieldInformation
7
+ def initialize
8
+ @name = nil
9
+ @_type = nil
10
+ @value = nil
11
+ @default_value = nil
12
+ @export_value = nil
13
+ @items = {}
14
+ @item_export_values = {}
15
+ end
16
+
17
+ #
18
+ # Gets or Sets the name of the choice field.
19
+ #
20
+ attr_accessor :name
21
+
22
+ #
23
+ # Gets or sets the ChoiceFieldType. ex: ListBox, ComboBox etc.
24
+ #
25
+ attr_accessor :type
26
+
27
+ #
28
+ # Gets or sets the value of the choice field.
29
+ #
30
+ attr_accessor :value
31
+
32
+ #
33
+ # Gets or Sets the default value of the choice field.
34
+ #
35
+ attr_accessor :default_value
36
+
37
+ #
38
+ # Gets or Sets the export value.
39
+ #
40
+ attr_accessor :export_value
41
+
42
+ #
43
+ # Gets the collection of items.
44
+ #
45
+ attr_accessor :items
46
+
47
+ #
48
+ # Gets the collection of export values of the items present in the choice field.
49
+ #
50
+ attr_accessor :item_export_values
51
+ end
52
+ end
@@ -0,0 +1,16 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies type of the Choice Field.
4
+ #
5
+ class ChoiceFieldType
6
+ #
7
+ # Represents a List box.
8
+ #
9
+ LIST_BOX = 'listBox'.freeze
10
+
11
+ #
12
+ # Represents a Combo box.
13
+ #
14
+ COMBO_BOX = 'comboBox'.freeze
15
+ end
16
+ end
@@ -0,0 +1,47 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Color'
3
+
4
+ #
5
+ # Represents a CMYK color.
6
+ #
7
+ class CmykColor < Color
8
+ #
9
+ # Initializes a new instance of the CmykColor class.
10
+ #
11
+ # Values must be between 0.0 and 1.0.
12
+ #
13
+ # @param cyan [float] The cyan intensity.
14
+ # @param magenta [float] The magenta intensity.
15
+ # @param yellow [float] The yellow intensity.
16
+ # @param black [float] The black intensity.
17
+ #
18
+ def initialize(cyan = 0, magenta = 0, yellow = 0, black = 0)
19
+ super()
20
+ if cyan < 0.0 || cyan > 1.0 || magenta < 0.0 || magenta > 1.0 || yellow < 0.0 || yellow > 1.0 || black < 0.0 || black > 1.0
21
+ raise 'CMYK values must be from 0.0 to 1.0.'
22
+ end
23
+
24
+ @_color_string = "cmyk(#{cyan},#{magenta},#{yellow},#{black})"
25
+ @cyan = cyan
26
+ @magenta = magenta
27
+ @yellow = yellow
28
+ @black = black
29
+ end
30
+
31
+ #
32
+ # Gets the color black.
33
+ #
34
+ def black
35
+ CmykColor.new(1, 1, 1, 1)
36
+ end
37
+
38
+ #
39
+ # Gets the color white.
40
+ #
41
+ def white
42
+ CmykColor.new(0, 0, 0, 0)
43
+ end
44
+
45
+ attr_accessor :_color_string
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Base class representing a color.
4
+ #
5
+ class Color
6
+ def initialize
7
+ @_color_string = nil
8
+ end
9
+
10
+ attr_accessor :_color_string
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies Color Space.
4
+ #
5
+ class ColorSpaceType
6
+ #
7
+ # Represents a Monochrome color space.
8
+ #
9
+ MONOCHROME = 'monochrome'.freeze
10
+
11
+ #
12
+ # Represents a Grayscale color space.
13
+ #
14
+ GRAYSCALE = 'grayscale'.freeze
15
+
16
+ #
17
+ # Represents an RGB color space.
18
+ #
19
+ RGB = 'rGB'.freeze
20
+
21
+ #
22
+ # Represents a CMYK color space.
23
+ #
24
+ CMYK = 'cMYK'.freeze
25
+
26
+ #
27
+ # Represents an Indexed color space.
28
+ #
29
+ INDEXED = 'indexed'.freeze
30
+
31
+ #
32
+ # Unknown color space.
33
+ #
34
+ UNKNOWN = 'unknown'.freeze
35
+ end
36
+ end
@@ -0,0 +1,100 @@
1
+ module DynamicPDFApi
2
+ require_relative 'Input'
3
+ #
4
+ # Represents the base class for inputs.
5
+ #
6
+ class ConverterInput < Input
7
+ def initialize(resource, size, orientation, margins)
8
+ super(resource)
9
+ self.page_size = size
10
+ self.page_orientation = orientation
11
+
12
+ if (margins != nil)
13
+ @top_margin = margins
14
+ @bottom_margin = margins
15
+ @right_margin = margins
16
+ @left_margin = margins
17
+ end
18
+ end
19
+
20
+ #
21
+ # Gets or sets the top margin.
22
+ #
23
+ attr_accessor :top_margin
24
+
25
+ #
26
+ # Gets or sets the left margin.
27
+ #
28
+ attr_accessor :left_margin
29
+
30
+ #
31
+ # Gets or sets the bottom margin.
32
+ #
33
+ attr_accessor :bottom_margin
34
+
35
+ #
36
+ # Gets or sets the right margin.
37
+ #
38
+ attr_accessor :right_margin
39
+
40
+ #
41
+ # Gets or sets the page width.
42
+ #
43
+ attr_accessor :page_width
44
+
45
+ #
46
+ # Gets or sets the page height.
47
+ #
48
+ attr_accessor :page_height
49
+
50
+ #attr_accessor :page_size
51
+
52
+ attr_accessor :_smaller, :_larger
53
+ #
54
+ # Gets or sets the page size.
55
+ #
56
+ def page_size=(value)
57
+ @page_size = value
58
+
59
+ output_size = UnitConverter.get_paper_size(value)
60
+
61
+ @_larger = output_size.larger
62
+ @_smaller = output_size.smaller
63
+
64
+ if @page_orientation == PageOrientation::PORTRAIT
65
+ @page_height = @_larger
66
+ @page_width = @_smaller
67
+ else
68
+ @page_height = @_smaller
69
+ @page_width = @_larger
70
+ end
71
+ end
72
+
73
+ #
74
+ # Gets or sets page orientation.
75
+ #
76
+ def page_orientation=(value)
77
+ @page_orientation = value
78
+
79
+ if @page_width > @page_height
80
+ @_smaller = @page_height
81
+ @_larger = @page_width
82
+ else
83
+ @_smaller = @page_width
84
+ @_larger = @page_height
85
+ end
86
+
87
+ if @page_orientation == PageOrientation::PORTRAIT
88
+ @page_height = @_larger
89
+ @page_width = @_smaller
90
+ else
91
+ @page_height = @_smaller
92
+ @page_width = @_larger
93
+ end
94
+ end
95
+
96
+ def to_json(_options = {})
97
+ JSON.pretty_generate({})
98
+ end
99
+ end
100
+ end