dynamicpdf_api 1.0.1 → 1.1.1

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby_client/Elements/AztecBarcodeElement.rb +6 -10
  3. data/lib/ruby_client/Elements/Code11BarcodeElement.rb +3 -5
  4. data/lib/ruby_client/Elements/Code128BarcodeElement.rb +7 -11
  5. data/lib/ruby_client/Elements/Code25BarcodeElement.rb +3 -5
  6. data/lib/ruby_client/Elements/Code39BarcodeElement.rb +4 -5
  7. data/lib/ruby_client/Elements/Code93BarcodeElement.rb +3 -5
  8. data/lib/ruby_client/Elements/DataMatrixBarcodeElement.rb +4 -7
  9. data/lib/ruby_client/Elements/Element.rb +2 -2
  10. data/lib/ruby_client/Elements/Gs1DataBarBarcodeElement.rb +3 -5
  11. data/lib/ruby_client/Elements/Iata25BarcodeElement.rb +5 -8
  12. data/lib/ruby_client/Elements/MsiBarcodeElement.rb +3 -5
  13. data/lib/ruby_client/Elements/Pdf417BarcodeElement.rb +6 -10
  14. data/lib/ruby_client/Elements/QrCodeElement.rb +2 -4
  15. data/lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb +3 -5
  16. data/lib/ruby_client/Elements/TextBarcodeElement.rb +1 -1
  17. data/lib/ruby_client/FormField.rb +4 -12
  18. data/lib/ruby_client/Imaging/BmpColorFormat.rb +20 -0
  19. data/lib/ruby_client/Imaging/BmpImageFormat.rb +32 -0
  20. data/lib/ruby_client/Imaging/BmpMonochromeColorFormat.rb +37 -0
  21. data/lib/ruby_client/Imaging/ColorFormat.rb +18 -0
  22. data/lib/ruby_client/Imaging/ColorFormatType.rb +31 -0
  23. data/lib/ruby_client/Imaging/CompressionType.rb +16 -0
  24. data/lib/ruby_client/Imaging/DitheringAlgorithm.rb +21 -0
  25. data/lib/ruby_client/Imaging/DpiImageSize.rb +36 -0
  26. data/lib/ruby_client/Imaging/FixedImageSize.rb +39 -0
  27. data/lib/ruby_client/Imaging/GifImageFormat.rb +33 -0
  28. data/lib/ruby_client/Imaging/ImageFormat.rb +31 -0
  29. data/lib/ruby_client/Imaging/ImageFormatType.rb +31 -0
  30. data/lib/ruby_client/Imaging/ImageSize.rb +26 -0
  31. data/lib/ruby_client/Imaging/ImageSizeType.rb +26 -0
  32. data/lib/ruby_client/Imaging/ImageSizeUnit.rb +21 -0
  33. data/lib/ruby_client/Imaging/JpegImageFormat.rb +31 -0
  34. data/lib/ruby_client/Imaging/MaxImageSize.rb +38 -0
  35. data/lib/ruby_client/Imaging/PdfImage.rb +210 -0
  36. data/lib/ruby_client/Imaging/PdfImageResponse.rb +40 -0
  37. data/lib/ruby_client/Imaging/PercentageImageSize.rb +35 -0
  38. data/lib/ruby_client/Imaging/PngColorFormat.rb +18 -0
  39. data/lib/ruby_client/Imaging/PngImageFormat.rb +33 -0
  40. data/lib/ruby_client/Imaging/PngIndexedColorFormat.rb +32 -0
  41. data/lib/ruby_client/Imaging/PngMonochromeColorFormat.rb +23 -0
  42. data/lib/ruby_client/Imaging/QuantizationAlgorithm.rb +26 -0
  43. data/lib/ruby_client/Imaging/TiffColorFormat.rb +17 -0
  44. data/lib/ruby_client/Imaging/TiffImageFormat.rb +34 -0
  45. data/lib/ruby_client/Imaging/TiffIndexedColorFormat.rb +37 -0
  46. data/lib/ruby_client/Imaging/TiffMonochromeColorFormat.rb +40 -0
  47. data/lib/ruby_client/MergeOptions.rb +30 -30
  48. data/lib/ruby_client/Outline.rb +0 -2
  49. data/lib/ruby_client/Pdf.rb +22 -3
  50. data/lib/ruby_client/PdfInput.rb +1 -1
  51. data/lib/ruby_client/PdfInstructions.rb +3 -3
  52. data/lib/ruby_client/version.rb +1 -1
  53. data/lib/ruby_client.rb +29 -0
  54. metadata +31 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fb5af3697d5f2c467805e95b675d24789683267a5ec80651bf5979004cdc043
4
- data.tar.gz: 1e139dad9f270c8220cf3352cf1d245ee9c2cf18bae881b2503afee3dbdc2c2b
3
+ metadata.gz: c4109120bdd17cb9a250a144ac5d70ab3bd76f159cde2a464ea2bb6b46277c3a
4
+ data.tar.gz: 1b0c03015bd985f960553f505086efc7ebf744e7811d7d5631c1cb3d5ec1aaba
5
5
  SHA512:
6
- metadata.gz: e6b4c5063f958aafefa406a51840f55d275dca8cc5606ea5febdb393ddd449a84cea3bfdbe02569a5c8c8adc175b2251bb60a66b9e7e83312e0d293a87019e74
7
- data.tar.gz: ff5f48259c2cabdff79d4f19bda0419d04fd820ff67e55a2140da9b112a6f110f26a67c08d2354c5ca27594a3b3a7720c65efbd49cb15ba3b96413ecbbaed119
6
+ metadata.gz: c02430211c4ca94e5e9011fecee5a5cc8117127f1a1526b03f58dd8d81746964e9a81e1ee00c00028e743a75710f5f0a110119f992602d11308001619a93db15
7
+ data.tar.gz: d3d4145f7c2718dca04d42657d81b72f67ca173f12f96456fb27ec50fb4dc6c26a9b3a7447f9e2b792cfffb25ff797d51a7ad59b143488d1690646e8ddd93bfb
@@ -24,10 +24,10 @@ module DynamicPDFApi
24
24
  #
25
25
  def initialize(value, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
26
26
  @_type = ElementType::AZTEC_BARCODE
27
- @process_tilde = false
27
+ @process_tilde = nil
28
28
  @symbol_size = nil
29
29
  @aztec_error_correction = 0
30
- @reader_initialization_symbol = false
30
+ @reader_initialization_symbol = nil
31
31
  super(value, placement, x_offset, y_offset)
32
32
  end
33
33
 
@@ -71,15 +71,13 @@ module DynamicPDFApi
71
71
 
72
72
  json_array["type"] = "aztecBarcode"
73
73
 
74
- # if(@processTilde != nil)
75
- json_array["processTilde"] = @process_tilde
74
+ json_array["processTilde"] = @process_tilde unless @process_tilde.nil?
76
75
 
77
76
  json_array["symbolSize"] = @symbol_size unless @symbol_size.nil?
78
77
 
79
78
  json_array["aztecErrorCorrection"] = @aztec_error_correction unless @aztec_error_correction.nil?
80
79
 
81
- # if(@reader_initialization_symbol != nil)
82
- json_array["readerInitializationSymbol"] = @reader_initialization_symbol
80
+ json_array["readerInitializationSymbol"] = @reader_initialization_symbol unless @reader_initialization_symbol.nil?
83
81
 
84
82
  #--------------Dim2BarcodeElement------------------------------
85
83
 
@@ -101,11 +99,9 @@ module DynamicPDFApi
101
99
 
102
100
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
103
101
 
104
- # if(@even_pages != nil)
105
- json_array["evenPages"] = @even_pages
102
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
106
103
 
107
- # if(@odd_pages != nil)
108
- json_array["oddPages"] = @odd_pages
104
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
109
105
 
110
106
  JSON.pretty_generate(json_array)
111
107
  end
@@ -47,7 +47,7 @@ module DynamicPDFApi
47
47
 
48
48
  json_array["fontSize"] = @font_size unless @font_size.nil?
49
49
 
50
- json_array["showText"] = @show_text if @show_text != "nil"
50
+ json_array["showText"] = @show_text unless @show_text.nil?
51
51
 
52
52
  #----------------barcodeElement--------------------------------
53
53
 
@@ -65,11 +65,9 @@ module DynamicPDFApi
65
65
 
66
66
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
67
67
 
68
- # if(@evenPages != nil)
69
- json_array["evenPages"] = @even_pages
68
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
70
69
 
71
- # if(@oddPages != nil)
72
- json_array["oddPages"] = @odd_pages
70
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
73
71
 
74
72
  JSON.pretty_generate(json_array)
75
73
  end
@@ -24,8 +24,8 @@ module DynamicPDFApi
24
24
  # @param y_offset [float] The Y coordinate of the barcode.
25
25
  #
26
26
  def initialize(value, height, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
27
- @ucc_ean128 = false
28
- @process_tilde = false
27
+ @ucc_ean128 = nil
28
+ @process_tilde = nil
29
29
  @_type = ElementType::CODE128_BARCODE
30
30
  super(value, placement, x_offset, y_offset)
31
31
  @height = height
@@ -62,11 +62,9 @@ module DynamicPDFApi
62
62
 
63
63
  json_array["height"] = @height unless @height.nil?
64
64
 
65
- # if(@ucc_ean128 != nil)
66
- json_array["uccEan128"] = @ucc_ean128
65
+ json_array["uccEan128"] = @ucc_ean128 unless @ucc_ean128.nil?
67
66
 
68
- # if(@process_tilde != nil)
69
- json_array["processTilde"] = @process_tilde
67
+ json_array["processTilde"] = @process_tilde unless @process_tilde.nil?
70
68
 
71
69
  #----------------TextBarcodeElement---------------------------------
72
70
  json_array["font"] = @_font_name unless @_font_name.nil?
@@ -75,7 +73,7 @@ module DynamicPDFApi
75
73
 
76
74
  json_array["fontSize"] = @font_size unless @font_size.nil?
77
75
 
78
- json_array["showText"] = @show_text if @show_text != "nil"
76
+ json_array["showText"] = @show_text unless @show_text.nil?
79
77
 
80
78
  #----------------barcodeElement--------------------------------
81
79
 
@@ -93,11 +91,9 @@ module DynamicPDFApi
93
91
 
94
92
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
95
93
 
96
- # if(@even_pages != nil)
97
- json_array["evenPages"] = @even_pages
94
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
98
95
 
99
- # if(@odd_pages != nil)
100
- json_array["oddPages"] = @odd_pages
96
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
101
97
 
102
98
  JSON.pretty_generate(json_array)
103
99
  end
@@ -45,7 +45,7 @@ module DynamicPDFApi
45
45
 
46
46
  json_array["fontSize"] = @font_size unless @font_size.nil?
47
47
 
48
- json_array["showText"] = @show_text if @show_text != "nil"
48
+ json_array["showText"] = @show_text unless @show_text.nil?
49
49
 
50
50
  #----------------barcodeElement--------------------------------
51
51
 
@@ -63,11 +63,9 @@ module DynamicPDFApi
63
63
 
64
64
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
65
65
 
66
- # if(@even_pages != nil)
67
- json_array["evenPages"] = @even_pages
66
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
68
67
 
69
- # if(@odd_pages != nil)
70
- json_array["oddPages"] = @odd_pages
68
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
71
69
 
72
70
  JSON.pretty_generate(json_array)
73
71
  end
@@ -45,7 +45,7 @@ module DynamicPDFApi
45
45
 
46
46
  json_array["fontSize"] = @font_size unless @font_size.nil?
47
47
 
48
- json_array["showText"] = @show_text if @show_text != "nil"
48
+ json_array["showText"] = @show_text unless @show_text.nil?
49
49
 
50
50
  #----------------barcodeElement--------------------------------
51
51
 
@@ -63,11 +63,10 @@ module DynamicPDFApi
63
63
 
64
64
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
65
65
 
66
- # if(@even_pages != nil)
67
- json_array["evenPages"] = @even_pages
66
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
67
+
68
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
68
69
 
69
- # if(@odd_pages != nil)
70
- json_array["oddPages"] = @odd_pages
71
70
 
72
71
  JSON.pretty_generate(json_array)
73
72
  end
@@ -45,7 +45,7 @@ module DynamicPDFApi
45
45
 
46
46
  json_array["fontSize"] = @font_size unless @font_size.nil?
47
47
 
48
- json_array["showText"] = @show_text if @show_text != "nil"
48
+ json_array["showText"] = @show_text unless @show_text.nil?
49
49
 
50
50
  #----------------barcodeElement--------------------------------
51
51
 
@@ -63,11 +63,9 @@ module DynamicPDFApi
63
63
 
64
64
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
65
65
 
66
- # if(@even_pages != nil)
67
- json_array["evenPages"] = @even_pages
66
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
68
67
 
69
- # if(@odd_pages != nil)
70
- json_array["oddPages"] = @odd_pages
68
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
71
69
 
72
70
  JSON.pretty_generate(json_array)
73
71
  end
@@ -26,7 +26,7 @@ module DynamicPDFApi
26
26
  # @param function_character [String] The def character of the barcode.
27
27
  #
28
28
  def initialize(value, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0, symbol_size = DataMatrixSymbolSize::AUTO, encoding_type = DataMatrixEncodingType::AUTO, function_character = DataMatrixFunctionCharacter::NONE)
29
- @process_tilde = false
29
+ @process_tilde = nil
30
30
  @_type = ElementType::DATA_MATRIX_BARCODE
31
31
  super(value, placement, x_offset, y_offset)
32
32
  @_data_matrix_symbol_size = symbol_size
@@ -51,8 +51,7 @@ module DynamicPDFApi
51
51
 
52
52
  json_array["type"] = "dataMatrixBarcode"
53
53
 
54
- # if(@process_tilde != nil)
55
- json_array["processTilde"] = @process_tilde
54
+ json_array["processTilde"] = @process_tilde unless @process_tilde.nil?
56
55
 
57
56
  json_array["dataMatrixSymbolSize"] = @_data_matrix_symbol_size unless @_data_matrix_symbol_size.nil?
58
57
 
@@ -83,11 +82,9 @@ module DynamicPDFApi
83
82
 
84
83
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
85
84
 
86
- # if(@even_pages != nil)
87
- json_array["evenPages"] = @even_pages
85
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
88
86
 
89
- # if(@odd_pages != nil)
90
- json_array["oddPages"] = @odd_pages
87
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
91
88
 
92
89
  JSON.pretty_generate(json_array)
93
90
  end
@@ -6,8 +6,8 @@ module DynamicPDFApi
6
6
  #
7
7
  class Element
8
8
  def initialize(value = nil, placement = nil, x_offset = 0, y_offset = 0)
9
- @even_pages = false
10
- @odd_pages = false
9
+ @even_pages = nil
10
+ @odd_pages = nil
11
11
  @_text_font = nil
12
12
  @_resource = nil
13
13
  @_type = nil
@@ -46,7 +46,7 @@ module DynamicPDFApi
46
46
 
47
47
  json_array["fontSize"] = @font_size unless @font_size.nil?
48
48
 
49
- json_array["showText"] = @show_text if @show_text != "nil"
49
+ json_array["showText"] = @show_text unless @show_text.nil?
50
50
 
51
51
  #----------------barcodeElement--------------------------------
52
52
 
@@ -64,11 +64,9 @@ module DynamicPDFApi
64
64
 
65
65
  json_array["yOffset"] = @y_offset unless @y_offset.nil?
66
66
 
67
- # if(@even_pages != nil)
68
- json_array["evenPages"] = @even_pages
67
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
69
68
 
70
- # if(@odd_pages != nil)
71
- json_array["oddPages"] = @odd_pages
69
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
72
70
 
73
71
  JSON.pretty_generate(json_array)
74
72
  end
@@ -19,7 +19,7 @@ module DynamicPDFApi
19
19
  #
20
20
  def initialize(value, height, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
21
21
  @_type = ElementType::IATA25_BARCODE
22
- @include_check_digit = false
22
+ @include_check_digit = nil
23
23
  @height = height
24
24
  super(value, placement, x_offset, y_offset)
25
25
  end
@@ -41,8 +41,7 @@ module DynamicPDFApi
41
41
 
42
42
  json_array['type'] = 'iata25Barcode'
43
43
 
44
- # if(@IncludeCheckDigit != nil)
45
- json_array['includeCheckDigit'] = @include_check_digit
44
+ json_array['includeCheckDigit'] = @include_check_digit unless @include_check_digit.nil?
46
45
 
47
46
  json_array['height'] = @height unless @height.nil?
48
47
 
@@ -53,7 +52,7 @@ module DynamicPDFApi
53
52
 
54
53
  json_array['fontSize'] = @font_size unless @font_size.nil?
55
54
 
56
- json_array['showText'] = @show_text if @show_text != 'nil'
55
+ json_array['showText'] = @show_text unless @show_text.nil?
57
56
 
58
57
  #----------------barcodeElement--------------------------------
59
58
 
@@ -71,11 +70,9 @@ module DynamicPDFApi
71
70
 
72
71
  json_array['yOffset'] = @y_offset unless @y_offset.nil?
73
72
 
74
- # if(@even_pages != nil)
75
- json_array['evenPages'] = @even_pages
73
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
76
74
 
77
- # if(@odd_pages != nil)
78
- json_array['oddPages'] = @odd_pages
75
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
79
76
 
80
77
  JSON.pretty_generate(json_array)
81
78
  end
@@ -49,7 +49,7 @@ module DynamicPDFApi
49
49
 
50
50
  json_array['fontSize'] = @font_size unless @font_size.nil?
51
51
 
52
- json_array['showText'] = @show_text if @show_text != 'nil'
52
+ json_array['showText'] = @show_text unless @show_text.nil?
53
53
 
54
54
  #----------------barcodeElement--------------------------------
55
55
 
@@ -67,11 +67,9 @@ module DynamicPDFApi
67
67
 
68
68
  json_array['yOffset'] = @y_offset unless @y_offset.nil?
69
69
 
70
- # if(@even_pages != nil)
71
- json_array['evenPages'] = @even_pages
70
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
72
71
 
73
- # if(@odd_pages != nil)
74
- json_array['oddPages'] = @odd_pages
72
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
75
73
 
76
74
  JSON.pretty_generate(json_array)
77
75
  end
@@ -22,8 +22,8 @@ module DynamicPDFApi
22
22
  def initialize(value, columns, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
23
23
  @columns = nil
24
24
  @y_dimension = nil
25
- @process_tilde = false
26
- @compact_pdf417 = false
25
+ @process_tilde = nil
26
+ @compact_pdf417 = nil
27
27
  @error_correction = nil
28
28
  @compaction = nil
29
29
 
@@ -70,11 +70,9 @@ module DynamicPDFApi
70
70
 
71
71
  json_array['yDimension'] = @y_dimension unless @y_dimension.nil?
72
72
 
73
- # if(@process_tilde != nil)
74
- json_array['processTilde'] = @process_tilde
73
+ json_array["processTilde"] = @process_tilde unless @process_tilde.nil?
75
74
 
76
- # if(@CompactPdf417 != nil)
77
- json_array['compactPdf417'] = @compact_pdf417
75
+ json_array['compactPdf417'] = @compact_pdf417 unless @compact_pdf417.nil?
78
76
 
79
77
  json_array['errorCorrection'] = @error_correction unless @error_correction.nil?
80
78
 
@@ -100,11 +98,9 @@ module DynamicPDFApi
100
98
 
101
99
  json_array['yOffset'] = @y_offset unless @y_offset.nil?
102
100
 
103
- # if(@even_pages != nil)
104
- json_array['evenPages'] = @even_pages
101
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
105
102
 
106
- # if(@odd_pages != nil)
107
- json_array['oddPages'] = @odd_pages
103
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
108
104
 
109
105
  JSON.pretty_generate(json_array)
110
106
  end
@@ -65,11 +65,9 @@ module DynamicPDFApi
65
65
 
66
66
  json_array['yOffset'] = @y_offset unless @y_offset.nil?
67
67
 
68
- # if(@even_pages != nil)
69
- json_array['evenPages'] = @even_pages
68
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
70
69
 
71
- # if(@odd_pages != nil)
72
- json_array['oddPages'] = @odd_pages
70
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
73
71
 
74
72
  JSON.pretty_generate(json_array)
75
73
  end
@@ -60,7 +60,7 @@ module DynamicPDFApi
60
60
 
61
61
  json_array['fontSize'] = @font_size unless @font_size.nil?
62
62
 
63
- json_array['showText'] = @show_text if @show_text != 'nil'
63
+ json_array["showText"] = @show_text unless @show_text.nil?
64
64
 
65
65
  #----------------barcodeElement--------------------------------
66
66
 
@@ -78,11 +78,9 @@ module DynamicPDFApi
78
78
 
79
79
  json_array['yOffset'] = @y_offset unless @y_offset.nil?
80
80
 
81
- # if(@even_pages != nil)
82
- json_array['evenPages'] = @even_pages
81
+ json_array["evenPages"] = @even_pages unless @even_pages.nil?
83
82
 
84
- # if(@odd_pages != nil)
85
- json_array['oddPages'] = @odd_pages
83
+ json_array["oddPages"] = @odd_pages unless @odd_pages.nil?
86
84
 
87
85
  JSON.pretty_generate(json_array)
88
86
  end
@@ -8,7 +8,7 @@ module DynamicPDFApi
8
8
  def initialize(value, placement, x_offset, y_offset)
9
9
  @text_color = nil
10
10
  @font_size = nil
11
- @show_text = 'nil'
11
+ @show_text = nil
12
12
  @_resource = nil
13
13
  @_text_font = nil
14
14
  @_font_name = nil
@@ -42,21 +42,13 @@ module DynamicPDFApi
42
42
  def to_json(_options = {})
43
43
  json_array = {}
44
44
  json_array['name'] = @name
45
- json_array['value'] = @value
45
+ json_array['value'] = @value unless @value.nil?
46
46
 
47
- json_array['flatten'] = if !@flatten.nil?
48
- @flatten
49
- else
50
- false
51
- end
47
+ json_array['flatten'] = @flatten unless @flatten.nil?
52
48
 
53
- json_array['remove'] = if !@remove.nil?
54
- @remove
55
- else
56
- false
57
- end
49
+ json_array['remove'] = @remove unless @remove.nil?
58
50
 
59
- JSON.pretty_generate(json_array)
51
+ JSON.pretty_generate(json_array)
60
52
  end
61
53
  end
62
54
  end
@@ -0,0 +1,20 @@
1
+ module DynamicPDFApi
2
+ require_relative 'ColorFormat'
3
+ require_relative 'ColorFormatType'
4
+
5
+ #
6
+ # Base class for BMP color formats
7
+ #
8
+ class BmpColorFormat < ColorFormat
9
+ #
10
+ # Creates a new BmpColorFormat object with the given type.
11
+ #
12
+ def initialize(type)
13
+ if type != ColorFormatType::Monochrome
14
+ @type = ColorFormatType::RGB
15
+ else
16
+ @type = type
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ module DynamicPDFApi
2
+ require_relative 'ImageFormat'
3
+ require_relative 'ImageFormatType'
4
+
5
+ #
6
+ # Represents BMP image format with color format.
7
+ #
8
+ class BmpImageFormat < ImageFormat
9
+ attr_accessor :color_format # Gets or sets the BmpColorFormat for BMP.
10
+
11
+ #
12
+ # Initializes a new instance of the BmpImageFormat class.
13
+ #
14
+ def initialize
15
+ super(ImageFormatType::BMP)
16
+ @color_format = nil
17
+ end
18
+
19
+ #
20
+ # Returns a JSON representation of the BmpImageFormat object.
21
+ #
22
+ # @return [String] JSON string representing the BmpImageFormat object.
23
+ #
24
+ def to_json(_options = {})
25
+ json_array = {}
26
+ json_array['type'] = 'bmp'
27
+
28
+ json_array['colorFormat'] = @color_format
29
+ JSON.pretty_generate(json_array)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,37 @@
1
+ module DynamicPDFApi
2
+ require_relative 'BmpColorFormat'
3
+ require_relative 'ColorFormatType'
4
+
5
+
6
+ #
7
+ # Represents monochrome color format for BMP.
8
+ #
9
+ class BmpMonochromeColorFormat < BmpColorFormat
10
+ attr_accessor :black_threshold # Gets or sets the black threshold for monochrome BMP, ranges from 0-255.
11
+ attr_accessor :dithering_percent # Gets or sets the dithering percentage for BMP.
12
+ attr_accessor :dithering_algorithm # Gets or sets the dithering algorithm for BMP.
13
+
14
+ #
15
+ # Creates object for monochrome color format for BMP image format.
16
+ #
17
+ def initialize
18
+ super(ColorFormatType::Monochrome)
19
+ @black_threshold = nil
20
+ @dithering_percent = nil
21
+ @dithering_algorithm = nil
22
+ end
23
+
24
+ #
25
+ # Returns a JSON representation of the BmpMonochromeColorFormat object.
26
+ #
27
+ # @return [String] JSON string representing the BmpMonochromeColorFormat object.
28
+ #
29
+ def to_json(_options = {})
30
+ json_array = {}
31
+ json_array['blackThreshold'] = @black_threshold
32
+ json_array['ditheringPercent'] = @dithering_percent
33
+ json_array['ditheringAlgorithm'] = @dithering_algorithm
34
+ JSON.pretty_generate(json_array)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,18 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Base class for all color formats.
4
+ #
5
+ class ColorFormat
6
+ #
7
+ # Initializes a new instance of ColorFormat.
8
+ #
9
+ def initialize
10
+ @type = nil
11
+ end
12
+
13
+ #
14
+ # Gets or sets the color format type.
15
+ #
16
+ attr_accessor :type
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Enum representing color formats.
4
+ #
5
+ class ColorFormatType
6
+ #
7
+ # RGB color format.
8
+ #
9
+ RGB = :Rgb.freeze
10
+
11
+ #
12
+ # RGBA color format.
13
+ #
14
+ RGBA = :Rgba.freeze
15
+
16
+ #
17
+ # Grayscale color format.
18
+ #
19
+ Grayscale = :Grayscale.freeze
20
+
21
+ #
22
+ # Monochrome color format.
23
+ #
24
+ Monochrome = :Monochrome.freeze
25
+
26
+ #
27
+ # Indexed color format.
28
+ #
29
+ Indexed = :Indexed.freeze
30
+ end
31
+ end
@@ -0,0 +1,16 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Enum representing compression types.
4
+ #
5
+ class CompressionType
6
+ #
7
+ # CCIT Group 3 compression.
8
+ #
9
+ CcitGroup3 = :CcitGroup3.freeze
10
+
11
+ #
12
+ # CCIT Group 4 compression.
13
+ #
14
+ CcitGroup4 = :CcitGroup4.freeze
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Enum representing dithering algorithms.
4
+ #
5
+ class DitheringAlgorithm
6
+ #
7
+ # Floyd-Steinberg dithering algorithm.
8
+ #
9
+ FloydSteinberg = :FloydSteinberg.freeze
10
+
11
+ #
12
+ # Bayer dithering algorithm.
13
+ #
14
+ Bayer = :Bayer.freeze
15
+
16
+ #
17
+ # No dithering.
18
+ #
19
+ None = :None.freeze
20
+ end
21
+ end