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.
- checksums.yaml +4 -4
- data/lib/ruby_client/Imaging/BmpColorFormat.rb +20 -0
- data/lib/ruby_client/Imaging/BmpImageFormat.rb +32 -0
- data/lib/ruby_client/Imaging/BmpMonochromeColorFormat.rb +37 -0
- data/lib/ruby_client/Imaging/ColorFormat.rb +18 -0
- data/lib/ruby_client/Imaging/ColorFormatType.rb +31 -0
- data/lib/ruby_client/Imaging/CompressionType.rb +16 -0
- data/lib/ruby_client/Imaging/DitheringAlgorithm.rb +21 -0
- data/lib/ruby_client/Imaging/DpiImageSize.rb +36 -0
- data/lib/ruby_client/Imaging/FixedImageSize.rb +39 -0
- data/lib/ruby_client/Imaging/GifImageFormat.rb +33 -0
- data/lib/ruby_client/Imaging/ImageFormat.rb +31 -0
- data/lib/ruby_client/Imaging/ImageFormatType.rb +31 -0
- data/lib/ruby_client/Imaging/ImageSize.rb +26 -0
- data/lib/ruby_client/Imaging/ImageSizeType.rb +26 -0
- data/lib/ruby_client/Imaging/ImageSizeUnit.rb +21 -0
- data/lib/ruby_client/Imaging/JpegImageFormat.rb +31 -0
- data/lib/ruby_client/Imaging/MaxImageSize.rb +38 -0
- data/lib/ruby_client/Imaging/PdfImage.rb +210 -0
- data/lib/ruby_client/Imaging/PdfImageResponse.rb +40 -0
- data/lib/ruby_client/Imaging/PercentageImageSize.rb +35 -0
- data/lib/ruby_client/Imaging/PngColorFormat.rb +18 -0
- data/lib/ruby_client/Imaging/PngImageFormat.rb +33 -0
- data/lib/ruby_client/Imaging/PngIndexedColorFormat.rb +32 -0
- data/lib/ruby_client/Imaging/PngMonochromeColorFormat.rb +23 -0
- data/lib/ruby_client/Imaging/QuantizationAlgorithm.rb +26 -0
- data/lib/ruby_client/Imaging/TiffColorFormat.rb +17 -0
- data/lib/ruby_client/Imaging/TiffImageFormat.rb +34 -0
- data/lib/ruby_client/Imaging/TiffIndexedColorFormat.rb +37 -0
- data/lib/ruby_client/Imaging/TiffMonochromeColorFormat.rb +40 -0
- data/lib/ruby_client/Outline.rb +0 -2
- data/lib/ruby_client/PageInput.rb +51 -45
- data/lib/ruby_client/Pdf.rb +22 -3
- data/lib/ruby_client/PdfInstructions.rb +3 -3
- data/lib/ruby_client/version.rb +1 -1
- data/lib/ruby_client.rb +29 -0
- metadata +33 -4
@@ -5,40 +5,37 @@ module DynamicPDFApi
|
|
5
5
|
# Represents a page input.
|
6
6
|
#
|
7
7
|
class PageInput < Input
|
8
|
-
|
9
|
-
DefaultPagewidth = 612.0.freeze
|
8
|
+
|
10
9
|
#
|
11
10
|
# Initializes a new instance of the PageInput class.
|
12
11
|
#
|
13
|
-
# @param
|
14
|
-
# @param
|
12
|
+
# @param size [String] | [Float] The size of the page or The width of the page.
|
13
|
+
# @param orientation [String] | [Float] The orientation of the page or The height of the page.
|
14
|
+
# @param margins [Float] The margins of the page.
|
15
15
|
#
|
16
|
-
def initialize(
|
17
|
-
@page_size = nil
|
18
|
-
@page_orientation = nil
|
16
|
+
def initialize(size = nil, orientation = nil, margins = nil)
|
19
17
|
super()
|
20
18
|
@_resources = []
|
21
19
|
@elements = []
|
22
20
|
@_type = InputType::PAGE
|
23
|
-
@page_width = page_width
|
24
|
-
@page_height = page_height
|
25
|
-
end
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
if (size.is_a?(String) && orientation.is_a?(String))
|
23
|
+
if (size != nil)
|
24
|
+
self.page_size = size
|
25
|
+
end
|
26
|
+
if (orientation != nil)
|
27
|
+
self.page_orientation = orientation
|
28
|
+
end
|
29
|
+
|
30
|
+
if (margins != nil)
|
31
|
+
@top_margin = margins
|
32
|
+
@bottom_margin = margins
|
33
|
+
@right_margin = margins
|
34
|
+
@left_margin = margins
|
35
|
+
end
|
36
|
+
elsif (size.is_a?(Float) || size.is_a?(Integer))
|
37
|
+
@page_width = size
|
38
|
+
@page_height = orientation
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
@@ -80,14 +77,14 @@ module DynamicPDFApi
|
|
80
77
|
def page_size=(value)
|
81
78
|
@page_size = value
|
82
79
|
|
83
|
-
@output_size = UnitConverter.
|
80
|
+
@output_size = UnitConverter.get_paper_size(value)
|
84
81
|
|
85
|
-
if
|
86
|
-
@page_height = @output_size.larger
|
87
|
-
@page_width = @output_size.smaller
|
88
|
-
else
|
82
|
+
if @page_orientation == PageOrientation::LANDSCAPE
|
89
83
|
@page_height = @output_size.smaller
|
90
84
|
@page_width = @output_size.larger
|
85
|
+
else
|
86
|
+
@page_height = @output_size.larger
|
87
|
+
@page_width = @output_size.smaller
|
91
88
|
end
|
92
89
|
end
|
93
90
|
|
@@ -97,23 +94,24 @@ module DynamicPDFApi
|
|
97
94
|
def page_orientation=(value)
|
98
95
|
@page_orientation = value
|
99
96
|
|
100
|
-
if
|
101
|
-
@
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
@
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
97
|
+
if(@page_width != nil && @page_height != nil)
|
98
|
+
if @page_width > @page_height
|
99
|
+
@smaller = @page_height
|
100
|
+
@larger_Width = @page_width
|
101
|
+
else
|
102
|
+
@smaller = @page_width
|
103
|
+
@larger_width = @page_height
|
104
|
+
end
|
105
|
+
|
106
|
+
if @page_orientation == PageOrientation::LANDSCAPE
|
107
|
+
@page_height = @smaller
|
108
|
+
@page_width = @larger_width
|
109
|
+
else
|
110
|
+
@page_height = @larger_width
|
111
|
+
@page_width = @smaller
|
112
|
+
end
|
114
113
|
end
|
115
114
|
end
|
116
|
-
|
117
115
|
#
|
118
116
|
# Gets or sets the elements of the page.
|
119
117
|
#
|
@@ -137,6 +135,14 @@ module DynamicPDFApi
|
|
137
135
|
|
138
136
|
json_array["pageHeight"] = @page_height unless @page_height.nil?
|
139
137
|
|
138
|
+
json_array["topMargin"] = @top_margin unless @top_margin.nil?
|
139
|
+
|
140
|
+
json_array["leftMargin"] = @left_margin unless @left_margin.nil?
|
141
|
+
|
142
|
+
json_array["bottomMargin"] = @bottom_margin unless @bottom_margin.nil?
|
143
|
+
|
144
|
+
json_array["rightMargin"] = @right_margin unless @right_margin.nil?
|
145
|
+
|
140
146
|
json_array["elements"] = json_element
|
141
147
|
|
142
148
|
#---------------------------------------------------
|
data/lib/ruby_client/Pdf.rb
CHANGED
@@ -51,11 +51,30 @@ module DynamicPDFApi
|
|
51
51
|
# <param name="resourceName">The name of the resource.
|
52
52
|
def add_additional_resource(resourcePath, resourceName = nil)
|
53
53
|
if (resourceName == nil)
|
54
|
-
resourceName =
|
54
|
+
resourceName = File.basename(resourcePath)
|
55
55
|
end
|
56
|
+
additional_resource = AdditionalResource.new(resourcePath, resourceName)
|
57
|
+
@resources[resourceName] = additional_resource
|
58
|
+
# @additionalResources << additional_resource
|
59
|
+
end
|
56
60
|
|
57
|
-
|
58
|
-
|
61
|
+
def add_additional_resource_with_resourcedata(resourceData, additionalResourceType, resourceName)
|
62
|
+
type = ResourceType::PDF
|
63
|
+
case (additionalResourceType)
|
64
|
+
|
65
|
+
when AdditionalResourceType::FONT
|
66
|
+
type = ResourceType::FONT
|
67
|
+
when AdditionalResourceType::IMAGE
|
68
|
+
type = ResourceType::IMAGE
|
69
|
+
when AdditionalResourceType::PDF
|
70
|
+
type = ResourceType::PDF
|
71
|
+
when AdditionalResourceType::HTML
|
72
|
+
type = ResourceType::HTML
|
73
|
+
else
|
74
|
+
raise 'This type of resource not allowed'
|
75
|
+
end
|
76
|
+
additional_resource = AdditionalResource.new(resourceData, resourceName, type)
|
77
|
+
@additionalResources << additional_resource
|
59
78
|
end
|
60
79
|
|
61
80
|
attr_accessor :instructions
|
@@ -18,7 +18,7 @@ module DynamicPDFApi
|
|
18
18
|
@_form_fields = []
|
19
19
|
@_templates = {}
|
20
20
|
@_fonts = {}
|
21
|
-
@
|
21
|
+
@_out_lines = []
|
22
22
|
@_inputs = []
|
23
23
|
@_security = nil
|
24
24
|
@_flatten_all_form_fields = nil
|
@@ -84,8 +84,8 @@ module DynamicPDFApi
|
|
84
84
|
json_array['formFields'] = @_form_fields
|
85
85
|
end
|
86
86
|
|
87
|
-
if(
|
88
|
-
json_array['outlines'] = @
|
87
|
+
if(!@_out_lines._out_lines.empty?)
|
88
|
+
json_array['outlines'] = @_out_lines
|
89
89
|
end
|
90
90
|
if(indented)
|
91
91
|
JSON.pretty_generate(json_array)
|
data/lib/ruby_client/version.rb
CHANGED
data/lib/ruby_client.rb
CHANGED
@@ -115,6 +115,35 @@ require_relative "ruby_client/Elements/StackedGs1DataBarType.rb"
|
|
115
115
|
require_relative "ruby_client/Elements/TextBarcodeElement.rb"
|
116
116
|
require_relative "ruby_client/Elements/TextElement.rb"
|
117
117
|
require_relative "ruby_client/Elements/ValueType.rb"
|
118
|
+
require_relative "ruby_client/Imaging/ColorFormatType.rb"
|
119
|
+
require_relative "ruby_client/Imaging/CompressionType.rb"
|
120
|
+
require_relative "ruby_client/Imaging/DitheringAlgorithm.rb"
|
121
|
+
require_relative "ruby_client/Imaging/DpiImageSize.rb"
|
122
|
+
require_relative "ruby_client/Imaging/FixedImageSize.rb"
|
123
|
+
require_relative "ruby_client/Imaging/GifImageFormat.rb"
|
124
|
+
require_relative "ruby_client/Imaging/ImageFormat.rb"
|
125
|
+
require_relative "ruby_client/Imaging/ImageFormatType.rb"
|
126
|
+
require_relative "ruby_client/Imaging/ImageSize.rb"
|
127
|
+
require_relative "ruby_client/Imaging/ImageSizeType.rb"
|
128
|
+
require_relative "ruby_client/Imaging/ImageSizeUnit.rb"
|
129
|
+
require_relative "ruby_client/Imaging/JpegImageFormat.rb"
|
130
|
+
require_relative "ruby_client/Imaging/MaxImageSize.rb"
|
131
|
+
require_relative "ruby_client/Imaging/PercentageImageSize.rb"
|
132
|
+
require_relative "ruby_client/Imaging/PngColorFormat.rb"
|
133
|
+
require_relative "ruby_client/Imaging/PngImageFormat.rb"
|
134
|
+
require_relative "ruby_client/Imaging/PngIndexedColorFormat.rb"
|
135
|
+
require_relative "ruby_client/Imaging/PngMonochromeColorFormat.rb"
|
136
|
+
require_relative "ruby_client/Imaging/QuantizationAlgorithm.rb"
|
137
|
+
require_relative "ruby_client/Imaging/PdfImage.rb"
|
138
|
+
require_relative "ruby_client/Imaging/PdfImageResponse.rb"
|
139
|
+
require_relative "ruby_client/Imaging/TiffColorFormat.rb"
|
140
|
+
require_relative "ruby_client/Imaging/TiffImageFormat.rb"
|
141
|
+
require_relative "ruby_client/Imaging/TiffIndexedColorFormat.rb"
|
142
|
+
require_relative "ruby_client/Imaging/TiffMonochromeColorFormat.rb"
|
143
|
+
require_relative "ruby_client/Imaging/BmpColorFormat.rb"
|
144
|
+
require_relative "ruby_client/Imaging/BmpImageFormat.rb"
|
145
|
+
require_relative "ruby_client/Imaging/BmpMonochromeColorFormat.rb"
|
146
|
+
require_relative "ruby_client/Imaging/ColorFormat.rb"
|
118
147
|
|
119
148
|
module RubyClient
|
120
149
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamicpdf_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dynamicpdf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby Client API that uses the DynamicPDF API to create, merge, split,
|
14
14
|
form fill, stamp, secure/encrypt PDF documents and convert word/Excel files to PDF.
|
@@ -91,6 +91,35 @@ files:
|
|
91
91
|
- lib/ruby_client/ImageInput.rb
|
92
92
|
- lib/ruby_client/ImageResource.rb
|
93
93
|
- lib/ruby_client/ImageResponse.rb
|
94
|
+
- lib/ruby_client/Imaging/BmpColorFormat.rb
|
95
|
+
- lib/ruby_client/Imaging/BmpImageFormat.rb
|
96
|
+
- lib/ruby_client/Imaging/BmpMonochromeColorFormat.rb
|
97
|
+
- lib/ruby_client/Imaging/ColorFormat.rb
|
98
|
+
- lib/ruby_client/Imaging/ColorFormatType.rb
|
99
|
+
- lib/ruby_client/Imaging/CompressionType.rb
|
100
|
+
- lib/ruby_client/Imaging/DitheringAlgorithm.rb
|
101
|
+
- lib/ruby_client/Imaging/DpiImageSize.rb
|
102
|
+
- lib/ruby_client/Imaging/FixedImageSize.rb
|
103
|
+
- lib/ruby_client/Imaging/GifImageFormat.rb
|
104
|
+
- lib/ruby_client/Imaging/ImageFormat.rb
|
105
|
+
- lib/ruby_client/Imaging/ImageFormatType.rb
|
106
|
+
- lib/ruby_client/Imaging/ImageSize.rb
|
107
|
+
- lib/ruby_client/Imaging/ImageSizeType.rb
|
108
|
+
- lib/ruby_client/Imaging/ImageSizeUnit.rb
|
109
|
+
- lib/ruby_client/Imaging/JpegImageFormat.rb
|
110
|
+
- lib/ruby_client/Imaging/MaxImageSize.rb
|
111
|
+
- lib/ruby_client/Imaging/PdfImage.rb
|
112
|
+
- lib/ruby_client/Imaging/PdfImageResponse.rb
|
113
|
+
- lib/ruby_client/Imaging/PercentageImageSize.rb
|
114
|
+
- lib/ruby_client/Imaging/PngColorFormat.rb
|
115
|
+
- lib/ruby_client/Imaging/PngImageFormat.rb
|
116
|
+
- lib/ruby_client/Imaging/PngIndexedColorFormat.rb
|
117
|
+
- lib/ruby_client/Imaging/PngMonochromeColorFormat.rb
|
118
|
+
- lib/ruby_client/Imaging/QuantizationAlgorithm.rb
|
119
|
+
- lib/ruby_client/Imaging/TiffColorFormat.rb
|
120
|
+
- lib/ruby_client/Imaging/TiffImageFormat.rb
|
121
|
+
- lib/ruby_client/Imaging/TiffIndexedColorFormat.rb
|
122
|
+
- lib/ruby_client/Imaging/TiffMonochromeColorFormat.rb
|
94
123
|
- lib/ruby_client/Input.rb
|
95
124
|
- lib/ruby_client/InputType.rb
|
96
125
|
- lib/ruby_client/JsonResponse.rb
|
@@ -157,9 +186,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
186
|
version: 2.6.0
|
158
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
188
|
requirements:
|
160
|
-
- - "
|
189
|
+
- - ">="
|
161
190
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
191
|
+
version: '0'
|
163
192
|
requirements: []
|
164
193
|
rubygems_version: 3.3.3
|
165
194
|
signing_key:
|