dynamicpdf_api 1.0.0.pre.beta2 → 1.1.0

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby_client/Imaging/BmpColorFormat.rb +20 -0
  3. data/lib/ruby_client/Imaging/BmpImageFormat.rb +32 -0
  4. data/lib/ruby_client/Imaging/BmpMonochromeColorFormat.rb +37 -0
  5. data/lib/ruby_client/Imaging/ColorFormat.rb +18 -0
  6. data/lib/ruby_client/Imaging/ColorFormatType.rb +31 -0
  7. data/lib/ruby_client/Imaging/CompressionType.rb +16 -0
  8. data/lib/ruby_client/Imaging/DitheringAlgorithm.rb +21 -0
  9. data/lib/ruby_client/Imaging/DpiImageSize.rb +36 -0
  10. data/lib/ruby_client/Imaging/FixedImageSize.rb +39 -0
  11. data/lib/ruby_client/Imaging/GifImageFormat.rb +33 -0
  12. data/lib/ruby_client/Imaging/ImageFormat.rb +31 -0
  13. data/lib/ruby_client/Imaging/ImageFormatType.rb +31 -0
  14. data/lib/ruby_client/Imaging/ImageSize.rb +26 -0
  15. data/lib/ruby_client/Imaging/ImageSizeType.rb +26 -0
  16. data/lib/ruby_client/Imaging/ImageSizeUnit.rb +21 -0
  17. data/lib/ruby_client/Imaging/JpegImageFormat.rb +31 -0
  18. data/lib/ruby_client/Imaging/MaxImageSize.rb +38 -0
  19. data/lib/ruby_client/Imaging/PdfImage.rb +210 -0
  20. data/lib/ruby_client/Imaging/PdfImageResponse.rb +40 -0
  21. data/lib/ruby_client/Imaging/PercentageImageSize.rb +35 -0
  22. data/lib/ruby_client/Imaging/PngColorFormat.rb +18 -0
  23. data/lib/ruby_client/Imaging/PngImageFormat.rb +33 -0
  24. data/lib/ruby_client/Imaging/PngIndexedColorFormat.rb +32 -0
  25. data/lib/ruby_client/Imaging/PngMonochromeColorFormat.rb +23 -0
  26. data/lib/ruby_client/Imaging/QuantizationAlgorithm.rb +26 -0
  27. data/lib/ruby_client/Imaging/TiffColorFormat.rb +17 -0
  28. data/lib/ruby_client/Imaging/TiffImageFormat.rb +34 -0
  29. data/lib/ruby_client/Imaging/TiffIndexedColorFormat.rb +37 -0
  30. data/lib/ruby_client/Imaging/TiffMonochromeColorFormat.rb +40 -0
  31. data/lib/ruby_client/Outline.rb +0 -2
  32. data/lib/ruby_client/PageInput.rb +51 -45
  33. data/lib/ruby_client/Pdf.rb +22 -3
  34. data/lib/ruby_client/PdfInstructions.rb +3 -3
  35. data/lib/ruby_client/version.rb +1 -1
  36. data/lib/ruby_client.rb +29 -0
  37. metadata +33 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32136b64e58168f264140d20c960feb5fd7aacbfa6adbc97a37065abb7b15810
4
- data.tar.gz: ece27f9446f2d49bd9f0762a4aae3373a73f1f108a3de51e15ffa13c02990055
3
+ metadata.gz: 6f42bc787613e44286e726d180adfc0ea445d5398dfe16cedc82c493fc4ccd1a
4
+ data.tar.gz: de16d1e726916f97f16113f877b39fae03e86d412af0adbdb993e5a4bfff0ec7
5
5
  SHA512:
6
- metadata.gz: 79a273699db7b348524ef19f676b8c0deefc408a536ef96affd6ea92c56be44b82b6d54db858563584dbc4ace78103f593525f11a81d14db55ec0745c330b4d7
7
- data.tar.gz: 2197f6d713e15fe6d9f9e98a5771aa35f261e1752f1d13bf5d45b7bcdecc75a1412d5c8278b39920be40b61ffd04ea8c1b4d316d2958b7a5ef74d272fc48ea8b
6
+ metadata.gz: ce716f34048b25deb919ba964523acb9fffc6933e646b8f0286d9995019541284fa2b0be5bf7aaa58ccf6303557ba15e6795306a8634ca01ff43a10805af5720
7
+ data.tar.gz: 559e545b54529731b213a4a12b47c15717addefd878d447eeba751740f2cef2fc685624396e17564c315be32caaad62efa0fe4179f2510b6557e65d1534b1854
@@ -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
@@ -0,0 +1,36 @@
1
+ module DynamicPDFApi
2
+ require_relative "ImageSize"
3
+ require_relative "ImageSizeType"
4
+ #
5
+ # Represents an image size defined by DPI (Dots Per Inch).
6
+ #
7
+ class DpiImageSize < ImageSize
8
+ attr_accessor :horizontal_dpi # Gets or sets the horizontal DPI (Dots Per Inch) of the image.
9
+ attr_accessor :vertical_dpi # Gets or sets the vertical DPI (Dots Per Inch) of the image.
10
+
11
+ #
12
+ # Initializes a new instance of the DpiImageSize class and sets the image size type to DPI.
13
+ #
14
+ def initialize
15
+ super
16
+ @horizontal_dpi = nil
17
+ @vertical_dpi = nil
18
+ @type = ImageSizeType::Dpi
19
+ end
20
+
21
+ #
22
+ # Returns a JSON representation of the DpiImageSize object.
23
+ #
24
+ # @return [String] JSON string representing the DpiImageSize object.
25
+ #
26
+ def to_json(_options = {})
27
+ json_array = {}
28
+ json_array['type'] = 'dpi'
29
+
30
+ json_array['horizontalDpi'] = @horizontal_dpi
31
+ json_array['verticalDpi'] = @vertical_dpi
32
+
33
+ JSON.pretty_generate(json_array)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,39 @@
1
+ module DynamicPDFApi
2
+ require_relative "ImageSize"
3
+ require_relative "ImageSizeType"
4
+
5
+
6
+ #
7
+ # Represents an image size with fixed dimensions.
8
+ #
9
+ class FixedImageSize < ImageSize
10
+ attr_accessor :width # Gets or sets the width of the image.
11
+ attr_accessor :height # Gets or sets the height of the image.
12
+ attr_accessor :unit # Gets or sets the unit of measurement ImageSizeUnit for the width and height.
13
+
14
+ #
15
+ # Initializes a new instance of the FixedImageSize class and sets the image size type to Fixed.
16
+ #
17
+ def initialize
18
+ super()
19
+ @type = ImageSizeType::Fixed
20
+ @width = nil
21
+ @height = nil
22
+ @unit = nil
23
+ end
24
+
25
+ #
26
+ # Returns a JSON representation of the FixedImageSize object.
27
+ #
28
+ # @return [String] JSON string representing the FixedImageSize object.
29
+ #
30
+ def to_json(_options = {})
31
+ json_array = {}
32
+ json_array['type'] = 'fixed'
33
+ json_array['width'] = @width
34
+ json_array['height'] = @height
35
+ json_array['unit'] = @unit
36
+ JSON.pretty_generate(json_array)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,33 @@
1
+ module DynamicPDFApi
2
+ require_relative "ImageFormatType"
3
+ require_relative "ImageFormat"
4
+
5
+ # Represents GIF image format with dithering properties.
6
+ #
7
+ class GifImageFormat < ImageFormat
8
+ attr_accessor :dithering_percent # Gets or sets the dithering percentage.
9
+ attr_accessor :dithering_algorithm # Gets or sets the dithering algorithm.
10
+
11
+ #
12
+ # Initializes a new instance of the GifImageFormat class and sets the image format type to GIF.
13
+ #
14
+ def initialize
15
+ super(ImageFormatType::GIF)
16
+ @dithering_percent = nil
17
+ @dithering_algorithm = nil
18
+ end
19
+
20
+ #
21
+ # Returns a JSON representation of the GifImageFormat object.
22
+ #
23
+ # @return [String] JSON string representing the GifImageFormat object.
24
+ #
25
+ def to_json(_options = {})
26
+ json_array = {}
27
+ json_array['ditheringPercent'] = @dithering_percent
28
+ json_array['ditheringAlgorithm'] = @dithering_algorithm
29
+ json_array['type'] = 'gif'
30
+ JSON.pretty_generate(json_array)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Base class for image formats.
4
+ #
5
+ class ImageFormat
6
+ #
7
+ # Gets the image format type.
8
+ #
9
+ attr_reader :type
10
+
11
+ #
12
+ # Initializes a new instance of ImageFormat with the specified type.
13
+ #
14
+ # @param type [Symbol] The type of the image format.
15
+ #
16
+ def initialize(type)
17
+ @type = type
18
+ end
19
+
20
+ #
21
+ # Returns a JSON representation of the ImageFormat object.
22
+ #
23
+ # @return [String] JSON string representing the ImageFormat object.
24
+ #
25
+ def to_json(_options = {})
26
+ json_array = {}
27
+ json_array['type'] = @type
28
+ JSON.pretty_generate(json_array)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Enum representing supported image formats.
4
+ #
5
+ class ImageFormatType
6
+ #
7
+ # JPEG image format.
8
+ #
9
+ JPEG = :JPEG.freeze
10
+
11
+ #
12
+ # GIF image format.
13
+ #
14
+ GIF = :GIF.freeze
15
+
16
+ #
17
+ # BMP image format.
18
+ #
19
+ BMP = :BMP.freeze
20
+
21
+ #
22
+ # PNG image format.
23
+ #
24
+ PNG = :PNG.freeze
25
+
26
+ #
27
+ # TIFF image format.
28
+ #
29
+ TIFF = :TIFF.freeze
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Base class for image size types.
4
+ #
5
+ class ImageSize
6
+ attr_accessor :type # Type of the image size.
7
+
8
+ #
9
+ # Initializes a new instance of the ImageSize class.
10
+ #
11
+ def initialize
12
+ @type = nil
13
+ end
14
+
15
+ #
16
+ # Returns a JSON representation of the ImageSize object.
17
+ #
18
+ # @return [String] JSON string representing the ImageSize object.
19
+ #
20
+ def to_json(_options = {})
21
+ json_array = {}
22
+ json_array['type'] = @type
23
+ JSON.pretty_generate(json_array)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Enum specifying the type of image size.
4
+ #
5
+ class ImageSizeType
6
+ #
7
+ # DPI-based image size.
8
+ #
9
+ Dpi = :Dpi.freeze
10
+
11
+ #
12
+ # Fixed image size.
13
+ #
14
+ Fixed = :Fixed.freeze
15
+
16
+ #
17
+ # Image size that fits within a given maximum size.
18
+ #
19
+ Max = :Max.freeze
20
+
21
+ #
22
+ # Percentage-based image size.
23
+ #
24
+ Percentage = :Percentage.freeze
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ module DynamicPDFApi
2
+ #
3
+ # Specifies the unit of measurement for image size.
4
+ #
5
+ class ImageSizeUnit
6
+ #
7
+ # Millimeter unit of measurement.
8
+ #
9
+ Millimeter = :Millimeter.freeze
10
+
11
+ #
12
+ # Inch unit of measurement.
13
+ #
14
+ Inch = :Inch.freeze
15
+
16
+ #
17
+ # Point unit of measurement.
18
+ #
19
+ Point = :Point.freeze
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ module DynamicPDFApi
2
+ require_relative "ImageFormat"
3
+ require_relative "ImageFormatType"
4
+
5
+ #
6
+ # Represents JPEG image format with quality.
7
+ #
8
+ class JpegImageFormat < ImageFormat
9
+ attr_accessor :quality # Gets or sets the quality of the JPEG image.
10
+
11
+ #
12
+ # Initializes a new instance of the JpegImageFormat class.
13
+ #
14
+ def initialize
15
+ super(ImageFormatType::JPEG)
16
+ @quality = nil
17
+ end
18
+
19
+ #
20
+ # Returns a JSON representation of the JpegImageFormat object.
21
+ #
22
+ # @return [String] JSON string representing the JpegImageFormat object.
23
+ #
24
+ def to_json(_options = {})
25
+ json_array = {}
26
+ json_array['type'] = 'jpeg'
27
+ json_array['quality'] = @quality
28
+ JSON.pretty_generate(json_array)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ module DynamicPDFApi
2
+ require_relative "ImageSize"
3
+ require_relative "ImageSizeType"
4
+
5
+ #
6
+ # Represents an image size that fits within a specified maximum width and height.
7
+ #
8
+ class MaxImageSize < ImageSize
9
+ attr_accessor :max_width # Gets or sets the maximum width of the image.
10
+ attr_accessor :max_height # Gets or sets the maximum height of the image.
11
+ attr_accessor :unit # Gets or sets the unit of measurement for the maximum width and height.
12
+
13
+ #
14
+ # Initializes a new instance of the MaxImageSize class.
15
+ #
16
+ def initialize
17
+ super()
18
+ @max_width = nil
19
+ @max_height = nil
20
+ @unit = nil
21
+ @type = ImageSizeType::Max
22
+ end
23
+
24
+ #
25
+ # Returns a JSON representation of the MaxImageSize object.
26
+ #
27
+ # @return [String] JSON string representing the MaxImageSize object.
28
+ #
29
+ def to_json(_options = {})
30
+ json_array = {}
31
+ json_array['type'] = 'max'
32
+ json_array['maxWidth'] = @max_width
33
+ json_array['maxHeight'] = @max_height
34
+ json_array['unit'] = @unit
35
+ JSON.pretty_generate(json_array)
36
+ end
37
+ end
38
+ end