dynamicpdf_api 1.0.0.pre.beta → 1.0.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.
- checksums.yaml +4 -4
- data/lib/ruby_client/ConverterInput.rb +27 -20
- data/lib/ruby_client/ExcelInput.rb +1 -1
- data/lib/ruby_client/HtmlInput.rb +1 -1
- data/lib/ruby_client/PageInput.rb +51 -45
- data/lib/ruby_client/Pdf.rb +3 -3
- data/lib/ruby_client/WordInput.rb +1 -1
- data/lib/ruby_client/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fb5af3697d5f2c467805e95b675d24789683267a5ec80651bf5979004cdc043
|
4
|
+
data.tar.gz: 1e139dad9f270c8220cf3352cf1d245ee9c2cf18bae881b2503afee3dbdc2c2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b4c5063f958aafefa406a51840f55d275dca8cc5606ea5febdb393ddd449a84cea3bfdbe02569a5c8c8adc175b2251bb60a66b9e7e83312e0d293a87019e74
|
7
|
+
data.tar.gz: ff5f48259c2cabdff79d4f19bda0419d04fd820ff67e55a2140da9b112a6f110f26a67c08d2354c5ca27594a3b3a7720c65efbd49cb15ba3b96413ecbbaed119
|
@@ -6,8 +6,13 @@ require_relative 'Input'
|
|
6
6
|
class ConverterInput < Input
|
7
7
|
def initialize(resource, size, orientation, margins)
|
8
8
|
super(resource)
|
9
|
-
|
10
|
-
|
9
|
+
|
10
|
+
if (size != nil)
|
11
|
+
self.page_size = size
|
12
|
+
end
|
13
|
+
if (orientation != nil)
|
14
|
+
self.page_orientation = orientation
|
15
|
+
end
|
11
16
|
|
12
17
|
if (margins != nil)
|
13
18
|
@top_margin = margins
|
@@ -61,12 +66,12 @@ require_relative 'Input'
|
|
61
66
|
@_larger = output_size.larger
|
62
67
|
@_smaller = output_size.smaller
|
63
68
|
|
64
|
-
if @page_orientation == PageOrientation::
|
65
|
-
@page_height = @_larger
|
66
|
-
@page_width = @_smaller
|
67
|
-
else
|
69
|
+
if @page_orientation == PageOrientation::LANDSCAPE
|
68
70
|
@page_height = @_smaller
|
69
71
|
@page_width = @_larger
|
72
|
+
else
|
73
|
+
@page_height = @_larger
|
74
|
+
@page_width = @_smaller
|
70
75
|
end
|
71
76
|
end
|
72
77
|
|
@@ -76,20 +81,22 @@ require_relative 'Input'
|
|
76
81
|
def page_orientation=(value)
|
77
82
|
@page_orientation = value
|
78
83
|
|
79
|
-
if
|
80
|
-
@
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
@
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
84
|
+
if(@page_width != nil && @page_height != nil)
|
85
|
+
if @page_width > @page_height
|
86
|
+
@_smaller = @page_height
|
87
|
+
@_larger = @page_width
|
88
|
+
else
|
89
|
+
@_smaller = @page_width
|
90
|
+
@_larger = @page_height
|
91
|
+
end
|
92
|
+
|
93
|
+
if @page_orientation == PageOrientation::LANDSCAPE
|
94
|
+
@page_height = @_smaller
|
95
|
+
@page_width = @_larger
|
96
|
+
else
|
97
|
+
@page_height = @_larger
|
98
|
+
@page_width = @_smaller
|
99
|
+
end
|
93
100
|
end
|
94
101
|
end
|
95
102
|
|
@@ -14,7 +14,7 @@ module DynamicPDFApi
|
|
14
14
|
# @param name="size">The page size of the output PDF.
|
15
15
|
# @param name="orientation">The page orientation of the output PDF.
|
16
16
|
# @param name="margins">The page margins of the output PDF.
|
17
|
-
def initialize(resource, size =
|
17
|
+
def initialize(resource, size = nil, orientation = nil, margins = nil)
|
18
18
|
super(resource, size, orientation, margins)
|
19
19
|
@_type = InputType::EXCEL
|
20
20
|
|
@@ -13,7 +13,7 @@ module DynamicPDFApi
|
|
13
13
|
# @param size [PageSize] The page size of the output PDF.
|
14
14
|
# @param orientation [PageOrientation] The page orientation of the output PDF.
|
15
15
|
# @param margins [float] The page margins of the output PDF.
|
16
|
-
def initialize(resource, base_path = nil, size =
|
16
|
+
def initialize(resource, base_path = nil, size = nil, orientation = nil, margins = nil)
|
17
17
|
super(resource, size, orientation, margins)
|
18
18
|
|
19
19
|
@_type = InputType::HTML
|
@@ -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
@@ -149,7 +149,7 @@ module DynamicPDFApi
|
|
149
149
|
#
|
150
150
|
# @return HtmlInput HtmlInput object.
|
151
151
|
#
|
152
|
-
def add_html(html, basepath =
|
152
|
+
def add_html(html, basepath = nil, size = nil, orientation = nil, margins = nil)
|
153
153
|
input = nil
|
154
154
|
if file.is_a?(String)
|
155
155
|
input = HtmlInput.new(HtmlResource.new(html), basepath, size, orientation, margins)
|
@@ -168,7 +168,7 @@ module DynamicPDFApi
|
|
168
168
|
#
|
169
169
|
# @return WordInput WordInput object.
|
170
170
|
#
|
171
|
-
def add_word(resource, size =
|
171
|
+
def add_word(resource, size = nil, orientation = nil, margins = nil)
|
172
172
|
input = WordInput.new(resource, size, orientation, margins)
|
173
173
|
@inputs << input
|
174
174
|
input
|
@@ -181,7 +181,7 @@ module DynamicPDFApi
|
|
181
181
|
#
|
182
182
|
# @return ExcelInput ExcelInput object.
|
183
183
|
#
|
184
|
-
def add_excel(resource, size =
|
184
|
+
def add_excel(resource, size = nil, orientation = nil, margins = nil)
|
185
185
|
input = ExcelInput.new(resource, size, orientation, margins)
|
186
186
|
@inputs << input
|
187
187
|
input
|
@@ -14,7 +14,7 @@ module DynamicPDFApi
|
|
14
14
|
# @param name="size">The page size of the output PDF.
|
15
15
|
# @param name="orientation">The page orientation of the output PDF.
|
16
16
|
# @param name="margins">The page margins of the output PDF.
|
17
|
-
def initialize(resource, size =
|
17
|
+
def initialize(resource, size = nil, orientation = nil, margins = nil)
|
18
18
|
super(resource, size, orientation, margins)
|
19
19
|
@_type = InputType::WORD
|
20
20
|
|
data/lib/ruby_client/version.rb
CHANGED
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.0.
|
4
|
+
version: 1.0.1
|
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-06-24 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.
|
@@ -157,9 +157,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: 2.6.0
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- - "
|
160
|
+
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
162
|
+
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubygems_version: 3.3.3
|
165
165
|
signing_key:
|