ilovepdf 1.3.1 → 1.3.4
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 +5 -5
- data/.travis.yml +1 -1
- data/LICENSE +0 -0
- data/README.md +21 -1
- data/ilovepdf.gemspec +4 -3
- data/lib/ilovepdf/element.rb +79 -0
- data/lib/ilovepdf/errors.rb +8 -1
- data/lib/ilovepdf/file.rb +1 -1
- data/lib/ilovepdf/ilovepdf.rb +9 -5
- data/lib/ilovepdf/refinements.rb +30 -0
- data/lib/ilovepdf/request_payload/form_url_encoded.rb +54 -0
- data/lib/ilovepdf/servers.rb +7 -0
- data/lib/ilovepdf/signature/date_element.rb +16 -0
- data/lib/ilovepdf/signature/file_element.rb +60 -0
- data/lib/ilovepdf/signature/initials_element.rb +11 -0
- data/lib/ilovepdf/signature/input_element.rb +27 -0
- data/lib/ilovepdf/signature/management.rb +103 -0
- data/lib/ilovepdf/signature/name_element.rb +11 -0
- data/lib/ilovepdf/signature/receiver.rb +87 -0
- data/lib/ilovepdf/signature/signature_element.rb +11 -0
- data/lib/ilovepdf/signature/text_element.rb +17 -0
- data/lib/ilovepdf/signature.rb +5 -0
- data/lib/ilovepdf/signature_file.rb +10 -0
- data/lib/ilovepdf/task.rb +60 -15
- data/lib/ilovepdf/tool/compress.rb +2 -2
- data/lib/ilovepdf/tool/extract.rb +2 -2
- data/lib/ilovepdf/tool/imagepdf.rb +2 -2
- data/lib/ilovepdf/tool/merge.rb +2 -2
- data/lib/ilovepdf/tool/officepdf.rb +2 -2
- data/lib/ilovepdf/tool/pagenumber.rb +2 -2
- data/lib/ilovepdf/tool/pdfa.rb +2 -2
- data/lib/ilovepdf/tool/pdfjpg.rb +31 -9
- data/lib/ilovepdf/tool/protect.rb +2 -2
- data/lib/ilovepdf/tool/repair.rb +2 -2
- data/lib/ilovepdf/tool/rotate.rb +2 -2
- data/lib/ilovepdf/tool/signature.rb +134 -0
- data/lib/ilovepdf/tool/split.rb +2 -2
- data/lib/ilovepdf/tool/unlock.rb +2 -2
- data/lib/ilovepdf/tool/validate_pdfa.rb +2 -2
- data/lib/ilovepdf/tool/watermark.rb +33 -15
- data/lib/ilovepdf/version.rb +1 -1
- data/lib/ilovepdf.rb +19 -0
- data/samples/chained_task.rb +20 -0
- data/samples/signature_advanced.rb +74 -0
- data/samples/signature_basic.rb +21 -0
- data/samples/signature_management.rb +42 -0
- data/uploads/sample_pdf.pdf +0 -0
- metadata +40 -5
@@ -0,0 +1,74 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require 'ilovepdf'
|
3
|
+
|
4
|
+
# You can call task class directly
|
5
|
+
pub_key = "YOUR_PUBLIC_KEY"
|
6
|
+
priv_key = "YOUR_PRIVATE_KEY"
|
7
|
+
|
8
|
+
my_task = Ilovepdf::Tool::Signature.new(pub_key, priv_key)
|
9
|
+
my_task.add_brand(name: "my company name",logo: "/path/to/logo/logo.png")
|
10
|
+
my_task.language = "es"
|
11
|
+
my_task.lock_order = false # if false, allows receivers of signer type to sign in parallel.
|
12
|
+
# if true receivers of signer type must sign sequentially in order.
|
13
|
+
my_task.email_content(subject: "Subject of the first email", content: "content of the first email")
|
14
|
+
my_task.expiration_days = 55 # Number of days when it is going to expire the signature
|
15
|
+
my_task.reminders = 2 # Send reminders every 2 days.
|
16
|
+
my_task.verify_enabled = true # Add the QR code on the audit trail.
|
17
|
+
my_task.uuid_visible = true #Add uuid at the bottom of each signature. We highly recommend to leave the uuid_visible to true (the default value), otherwise it lowers the signature validity.
|
18
|
+
|
19
|
+
|
20
|
+
# File object keeps information about its server_filename and the properties you can set
|
21
|
+
file1 = my_task.add_file '/path/to/file/sample.pdf'
|
22
|
+
file2 = my_task.add_file '/path/to/file/sample2.pdf'
|
23
|
+
|
24
|
+
signer = Ilovepdf::Signature::Receiver.new(:signer,'name','email@email.com')
|
25
|
+
signer.phone = "34677231431" #Phone number with the country prefix at the beginning => "+34677231431", make sure you have enough credits.
|
26
|
+
signer.phone = "34677231431" #Phone number with the country prefix at the beginning => "+34677231431", make sure you have enough credits.
|
27
|
+
|
28
|
+
signature_element = Ilovepdf::Signature::SignatureElement.new(file1)
|
29
|
+
signature_element.set_position(x: 20,y: -20)
|
30
|
+
signature_element.pages = "1,2"
|
31
|
+
signature_element.size = 40
|
32
|
+
signer << signature_element
|
33
|
+
|
34
|
+
date_element = Ilovepdf::Signature::DateElement.new(file1)
|
35
|
+
date_element.set_position(x: 30,y: -40)
|
36
|
+
date_element.pages = "1-3"
|
37
|
+
date_element.size = 10
|
38
|
+
signer << date_element
|
39
|
+
|
40
|
+
initials_element = Ilovepdf::Signature::InitialsElement.new(file1)
|
41
|
+
initials_element.set_position(x: 20,y: -20)
|
42
|
+
initials_element.pages = "1,2"
|
43
|
+
initials_element.size = 40
|
44
|
+
signer << initials_element
|
45
|
+
|
46
|
+
input_element = Ilovepdf::Signature::InputElement.new(file2,"Input your ID Number", "Please, fill in your ID Number")
|
47
|
+
input_element.set_position(x: 20,y: -20)
|
48
|
+
input_element.pages = "1-3,4-10"
|
49
|
+
input_element.size = 30
|
50
|
+
signer << initials_element
|
51
|
+
|
52
|
+
name_element = Ilovepdf::Signature::NameElement.new(file1)
|
53
|
+
name_element.set_position(x: 300,y: -200)
|
54
|
+
name_element.pages = "3-5,6-10"
|
55
|
+
name_element.size = 40
|
56
|
+
signer << initials_element
|
57
|
+
|
58
|
+
text_element = Ilovepdf::Signature::TextElement.new(file2,"This is a text field")
|
59
|
+
text_element.set_position(x: 20,y: -20)
|
60
|
+
text_element.pages = "1"
|
61
|
+
text_element.size = 40
|
62
|
+
signer << text_element
|
63
|
+
|
64
|
+
my_task.add_receiver(signer) # << is an alias of add_receiver
|
65
|
+
|
66
|
+
witness = Ilovepdf::Signature::Receiver.new(:witness,'name2','email2@email.com')
|
67
|
+
my_task << witness
|
68
|
+
|
69
|
+
validator = Ilovepdf::Signature::Receiver.new(:validator,'name3','email3@email.com')
|
70
|
+
my_task << validator
|
71
|
+
|
72
|
+
body = my_task.send_to_sign.body
|
73
|
+
token = body["token_requester"]
|
74
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require 'ilovepdf'
|
3
|
+
|
4
|
+
# You can call task class directly
|
5
|
+
|
6
|
+
my_task = Ilovepdf::Tool::Signature.new(pub_key, priv_key)
|
7
|
+
# File object keeps information about its server_filename and the properties you can set
|
8
|
+
file = my_task.add_file '/path/to/file/sample.pdf'
|
9
|
+
|
10
|
+
signer = Ilovepdf::Signature::Receiver.new(:signer,'name','email@email.com')
|
11
|
+
|
12
|
+
signature_element = Ilovepdf::Signature::SignatureElement.new(file)
|
13
|
+
signature_element.set_position(x: 20,y: -20)
|
14
|
+
signature_element.pages = "1"
|
15
|
+
signature_element.size = 40
|
16
|
+
|
17
|
+
signer << signature_element
|
18
|
+
|
19
|
+
my_task << signer
|
20
|
+
|
21
|
+
body = my_task.send_to_sign.body
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require 'ilovepdf'
|
3
|
+
|
4
|
+
# You can call task class directly
|
5
|
+
|
6
|
+
signature_management = Ilovepdf::Signature::Management.new(pub_key, priv_key)
|
7
|
+
|
8
|
+
signature_token = "SIGNATURE_TOKEN"
|
9
|
+
receiver_token = "SIGNATURE_TOKEN"
|
10
|
+
|
11
|
+
# Get information about a single signature request
|
12
|
+
status_response = signature_management.get_status(signature_token).body
|
13
|
+
|
14
|
+
# list all of the signatures
|
15
|
+
list = signature_management.list_signatures(current_page: 0,per_page: 20).body
|
16
|
+
|
17
|
+
#Download the audit pdf of a signature request, just pass the file name, the program is going to put the file extension accordingly
|
18
|
+
path = signature_management.download_audit(signature_token,"/tmp/",create_directory: true, filename: "audit")
|
19
|
+
|
20
|
+
# Download the original file, the resulting file can be either a ".pdf" if only one file was used for that request or a ".zip" otherwise
|
21
|
+
path = signature_management.download_original(signature_token,"/tmp/",create_directory: true, filename: "original")
|
22
|
+
|
23
|
+
# Download the signed file, the resulting file can be either a ".pdf" if only one file was used for that request or a ".zip" otherwise
|
24
|
+
path = signature_management.download_signed(signature_token,"/tmp/",create_directory: true, filename: "signed")
|
25
|
+
|
26
|
+
# Send reminders to the receivers that did not yet performed his action
|
27
|
+
signature_management.send_reminders(signature_token)
|
28
|
+
|
29
|
+
# Void the signature
|
30
|
+
signature_management.void_signature(signature_token)
|
31
|
+
|
32
|
+
# Increase the expiration days by 3
|
33
|
+
signature_management.void_signature(signature_token, 3)
|
34
|
+
|
35
|
+
# Get info of a receiver
|
36
|
+
receiver_response = signature_management.get_receiver_info(signer_token).body
|
37
|
+
|
38
|
+
# Fix receiver email
|
39
|
+
receiver_response = signature_management.fix_receiver_email(signer_token,"newemail@email.com").body
|
40
|
+
|
41
|
+
# Fix receiver email
|
42
|
+
receiver_response = signature_management.fix_receiver_phone(signer_token,"34639000000").body
|
data/uploads/sample_pdf.pdf
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ilovepdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonardo Collazo
|
8
|
+
- Guillem Vidal
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rest-client
|
@@ -38,6 +39,20 @@ dependencies:
|
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: json
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '2'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '2'
|
41
56
|
- !ruby/object:Gem::Dependency
|
42
57
|
name: bundler
|
43
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +143,7 @@ description: Develop and automate PDF processing tasks like Compress PDF, Merge
|
|
128
143
|
to get your desired results.
|
129
144
|
email:
|
130
145
|
- leonardo.chronicles@gmail.com
|
146
|
+
- g.vidal.cantavella@gmail.com
|
131
147
|
executables: []
|
132
148
|
extensions: []
|
133
149
|
extra_rdoc_files: []
|
@@ -144,11 +160,26 @@ files:
|
|
144
160
|
- bin/setup
|
145
161
|
- ilovepdf.gemspec
|
146
162
|
- lib/ilovepdf.rb
|
163
|
+
- lib/ilovepdf/element.rb
|
147
164
|
- lib/ilovepdf/errors.rb
|
148
165
|
- lib/ilovepdf/file.rb
|
149
166
|
- lib/ilovepdf/helper.rb
|
150
167
|
- lib/ilovepdf/ilovepdf.rb
|
168
|
+
- lib/ilovepdf/refinements.rb
|
169
|
+
- lib/ilovepdf/request_payload/form_url_encoded.rb
|
151
170
|
- lib/ilovepdf/response.rb
|
171
|
+
- lib/ilovepdf/servers.rb
|
172
|
+
- lib/ilovepdf/signature.rb
|
173
|
+
- lib/ilovepdf/signature/date_element.rb
|
174
|
+
- lib/ilovepdf/signature/file_element.rb
|
175
|
+
- lib/ilovepdf/signature/initials_element.rb
|
176
|
+
- lib/ilovepdf/signature/input_element.rb
|
177
|
+
- lib/ilovepdf/signature/management.rb
|
178
|
+
- lib/ilovepdf/signature/name_element.rb
|
179
|
+
- lib/ilovepdf/signature/receiver.rb
|
180
|
+
- lib/ilovepdf/signature/signature_element.rb
|
181
|
+
- lib/ilovepdf/signature/text_element.rb
|
182
|
+
- lib/ilovepdf/signature_file.rb
|
152
183
|
- lib/ilovepdf/task.rb
|
153
184
|
- lib/ilovepdf/tool/compress.rb
|
154
185
|
- lib/ilovepdf/tool/extract.rb
|
@@ -161,11 +192,13 @@ files:
|
|
161
192
|
- lib/ilovepdf/tool/protect.rb
|
162
193
|
- lib/ilovepdf/tool/repair.rb
|
163
194
|
- lib/ilovepdf/tool/rotate.rb
|
195
|
+
- lib/ilovepdf/tool/signature.rb
|
164
196
|
- lib/ilovepdf/tool/split.rb
|
165
197
|
- lib/ilovepdf/tool/unlock.rb
|
166
198
|
- lib/ilovepdf/tool/validate_pdfa.rb
|
167
199
|
- lib/ilovepdf/tool/watermark.rb
|
168
200
|
- lib/ilovepdf/version.rb
|
201
|
+
- samples/chained_task.rb
|
169
202
|
- samples/compress_advanced.rb
|
170
203
|
- samples/compress_basic.rb
|
171
204
|
- samples/extract_advanced.rb
|
@@ -180,6 +213,9 @@ files:
|
|
180
213
|
- samples/repair_basic.rb
|
181
214
|
- samples/rotate_advanced.rb
|
182
215
|
- samples/rotate_basic.rb
|
216
|
+
- samples/signature_advanced.rb
|
217
|
+
- samples/signature_basic.rb
|
218
|
+
- samples/signature_management.rb
|
183
219
|
- samples/split_advanced.rb
|
184
220
|
- samples/split_advanced_merge.rb
|
185
221
|
- samples/split_basic.rb
|
@@ -203,15 +239,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
239
|
requirements:
|
204
240
|
- - ">="
|
205
241
|
- !ruby/object:Gem::Version
|
206
|
-
version: '2.
|
242
|
+
version: '2.6'
|
207
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
244
|
requirements:
|
209
245
|
- - ">="
|
210
246
|
- !ruby/object:Gem::Version
|
211
247
|
version: '0'
|
212
248
|
requirements: []
|
213
|
-
|
214
|
-
rubygems_version: 2.6.14
|
249
|
+
rubygems_version: 3.5.9
|
215
250
|
signing_key:
|
216
251
|
specification_version: 4
|
217
252
|
summary: A library in Ruby for iLovePDF Api
|