Class: CloudmersiveConvertApiClient::EditPdfApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EditPdfApi

Returns a new instance of EditPdfApi.



19
20
21
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#edit_pdf_decrypt(password, input_file, opts = {}) ⇒ String

Decrypt and password-protect a PDF Decrypt a PDF document with a password. Decrypted PDF will no longer require a password to open.

Parameters:

  • password

    Valid password for the PDF file

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


29
30
31
32
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 29

def edit_pdf_decrypt(password, input_file, opts = {})
  data, _status_code, _headers = edit_pdf_decrypt_with_http_info(password, input_file, opts)
  return data
end

#edit_pdf_decrypt_with_http_info(password, input_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Decrypt and password-protect a PDF Decrypt a PDF document with a password. Decrypted PDF will no longer require a password to open.

Parameters:

  • password

    Valid password for the PDF file

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 40

def edit_pdf_decrypt_with_http_info(password, input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_decrypt ..."
  end
  # verify the required parameter 'password' is set
  if @api_client.config.client_side_validation && password.nil?
    fail ArgumentError, "Missing the required parameter 'password' when calling EditPdfApi.edit_pdf_decrypt"
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_decrypt"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/decrypt"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'password'] = password

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_decrypt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_delete_pages(input_file, page_start, page_end, opts = {}) ⇒ String

Remove / delete pages from a PDF document Remove one or more pages from a PDF document

Parameters:

  • input_file

    Input file to perform the operation on.

  • page_start

    Page number (1 based) to start deleting pages from (inclusive).

  • page_end

    Page number (1 based) to stop deleting pages from (inclusive).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


93
94
95
96
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 93

def edit_pdf_delete_pages(input_file, page_start, page_end, opts = {})
  data, _status_code, _headers = edit_pdf_delete_pages_with_http_info(input_file, page_start, page_end, opts)
  return data
end

#edit_pdf_delete_pages_with_http_info(input_file, page_start, page_end, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Remove / delete pages from a PDF document Remove one or more pages from a PDF document

Parameters:

  • input_file

    Input file to perform the operation on.

  • page_start

    Page number (1 based) to start deleting pages from (inclusive).

  • page_end

    Page number (1 based) to stop deleting pages from (inclusive).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 105

def edit_pdf_delete_pages_with_http_info(input_file, page_start, page_end, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_delete_pages ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_delete_pages"
  end
  # verify the required parameter 'page_start' is set
  if @api_client.config.client_side_validation && page_start.nil?
    fail ArgumentError, "Missing the required parameter 'page_start' when calling EditPdfApi.edit_pdf_delete_pages"
  end
  # verify the required parameter 'page_end' is set
  if @api_client.config.client_side_validation && page_end.nil?
    fail ArgumentError, "Missing the required parameter 'page_end' when calling EditPdfApi.edit_pdf_delete_pages"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/pages/delete"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'pageStart'] = page_start
  header_params[:'pageEnd'] = page_end

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_delete_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_encrypt(input_file, opts = {}) ⇒ String

Encrypt and password-protect a PDF Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_password (String)

    Password of a user (reader) of the PDF file

  • :owner_password (String)

    Password of a owner (creator/editor) of the PDF file

  • :encryption_key_length (String)

    Possible values are &quot;128&quot; (128-bit RC4 encryption) and &quot;256&quot; (256-bit AES encryption). Default is 256.

Returns:

  • (String)


164
165
166
167
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 164

def edit_pdf_encrypt(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_encrypt_with_http_info(input_file, opts)
  return data
end

#edit_pdf_encrypt_with_http_info(input_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Encrypt and password-protect a PDF Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_password (String)

    Password of a user (reader) of the PDF file

  • :owner_password (String)

    Password of a owner (creator/editor) of the PDF file

  • :encryption_key_length (String)

    Possible values are &quot;128&quot; (128-bit RC4 encryption) and &quot;256&quot; (256-bit AES encryption). Default is 256.

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 177

def edit_pdf_encrypt_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_encrypt ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_encrypt"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/encrypt"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'userPassword'] = opts[:'user_password'] if !opts[:'user_password'].nil?
  header_params[:'ownerPassword'] = opts[:'owner_password'] if !opts[:'owner_password'].nil?
  header_params[:'encryptionKeyLength'] = opts[:'encryption_key_length'] if !opts[:'encryption_key_length'].nil?

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_encrypt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_get_form_fields(input_file, opts = {}) ⇒ PdfFormFields

Gets PDF Form fields and values Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



226
227
228
229
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 226

def edit_pdf_get_form_fields(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_get_form_fields_with_http_info(input_file, opts)
  return data
end

#edit_pdf_get_form_fields_with_http_info(input_file, opts = {}) ⇒ Array<(PdfFormFields, Fixnum, Hash)>

Gets PDF Form fields and values Encrypt a PDF document with a password. Set an owner password to control owner (editor/creator) permissions, and set a user (reader) password to control the viewer of the PDF. Set the password fields null to omit the given password.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PdfFormFields, Fixnum, Hash)>)

    PdfFormFields data, response status code and response headers



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 236

def edit_pdf_get_form_fields_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_get_form_fields ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_get_form_fields"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/form/get-fields"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PdfFormFields')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_form_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_get_metadata(input_file, opts = {}) ⇒ PdfMetadata

Get PDF document metadata Returns the metadata from the PDF document, including Title, Author, etc.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



282
283
284
285
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 282

def (input_file, opts = {})
  data, _status_code, _headers = (input_file, opts)
  return data
end

#edit_pdf_get_metadata_with_http_info(input_file, opts = {}) ⇒ Array<(PdfMetadata, Fixnum, Hash)>

Get PDF document metadata Returns the metadata from the PDF document, including Title, Author, etc.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PdfMetadata, Fixnum, Hash)>)

    PdfMetadata data, response status code and response headers



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 292

def (input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_get_metadata ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_get_metadata"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/get-metadata"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PdfMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_get_pdf_text_by_pages(input_file, opts = {}) ⇒ PdfTextByPageResult

Get text in a PDF document by page Gets the text in a PDF by page

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



338
339
340
341
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 338

def edit_pdf_get_pdf_text_by_pages(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_get_pdf_text_by_pages_with_http_info(input_file, opts)
  return data
end

#edit_pdf_get_pdf_text_by_pages_with_http_info(input_file, opts = {}) ⇒ Array<(PdfTextByPageResult, Fixnum, Hash)>

Get text in a PDF document by page Gets the text in a PDF by page

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PdfTextByPageResult, Fixnum, Hash)>)

    PdfTextByPageResult data, response status code and response headers



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 348

def edit_pdf_get_pdf_text_by_pages_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_get_pdf_text_by_pages ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_get_pdf_text_by_pages"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/pages/get-text"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PdfTextByPageResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_pdf_text_by_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_insert_pages(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {}) ⇒ String

Insert / copy pages from one PDF document into another Copy one or more pages from one PDF document (source document) and insert them into a second PDF document (destination document).

Parameters:

  • source_file

    Source PDF file to copy pages from.

  • destination_file

    Destination PDF file to copy pages into.

  • page_start_source

    Page number (1 based) to start copying pages from (inclusive) in the Source file.

  • page_end_source

    Page number (1 based) to stop copying pages pages from (inclusive) in the Source file.

  • page_insert_before_desitnation

    Page number (1 based) to insert the pages before in the Destination file.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


398
399
400
401
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 398

def edit_pdf_insert_pages(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {})
  data, _status_code, _headers = edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts)
  return data
end

#edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Insert / copy pages from one PDF document into another Copy one or more pages from one PDF document (source document) and insert them into a second PDF document (destination document).

Parameters:

  • source_file

    Source PDF file to copy pages from.

  • destination_file

    Destination PDF file to copy pages into.

  • page_start_source

    Page number (1 based) to start copying pages from (inclusive) in the Source file.

  • page_end_source

    Page number (1 based) to stop copying pages pages from (inclusive) in the Source file.

  • page_insert_before_desitnation

    Page number (1 based) to insert the pages before in the Destination file.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 412

def edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_insert_pages ..."
  end
  # verify the required parameter 'source_file' is set
  if @api_client.config.client_side_validation && source_file.nil?
    fail ArgumentError, "Missing the required parameter 'source_file' when calling EditPdfApi.edit_pdf_insert_pages"
  end
  # verify the required parameter 'destination_file' is set
  if @api_client.config.client_side_validation && destination_file.nil?
    fail ArgumentError, "Missing the required parameter 'destination_file' when calling EditPdfApi.edit_pdf_insert_pages"
  end
  # verify the required parameter 'page_start_source' is set
  if @api_client.config.client_side_validation && page_start_source.nil?
    fail ArgumentError, "Missing the required parameter 'page_start_source' when calling EditPdfApi.edit_pdf_insert_pages"
  end
  # verify the required parameter 'page_end_source' is set
  if @api_client.config.client_side_validation && page_end_source.nil?
    fail ArgumentError, "Missing the required parameter 'page_end_source' when calling EditPdfApi.edit_pdf_insert_pages"
  end
  # verify the required parameter 'page_insert_before_desitnation' is set
  if @api_client.config.client_side_validation && page_insert_before_desitnation.nil?
    fail ArgumentError, "Missing the required parameter 'page_insert_before_desitnation' when calling EditPdfApi.edit_pdf_insert_pages"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/pages/insert"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'pageStartSource'] = page_start_source
  header_params[:'pageEndSource'] = page_end_source
  header_params[:'pageInsertBeforeDesitnation'] = page_insert_before_desitnation

  # form parameters
  form_params = {}
  form_params["sourceFile"] = source_file
  form_params["destinationFile"] = destination_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_insert_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_rasterize(input_file, opts = {}) ⇒ String

Rasterize a PDF to an image-based PDF Rasterize a PDF into an image-based PDF. The output is a PDF where each page is comprised of a high-resolution image, with all text, figures and other components removed.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


478
479
480
481
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 478

def edit_pdf_rasterize(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_rasterize_with_http_info(input_file, opts)
  return data
end

#edit_pdf_rasterize_with_http_info(input_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Rasterize a PDF to an image-based PDF Rasterize a PDF into an image-based PDF. The output is a PDF where each page is comprised of a high-resolution image, with all text, figures and other components removed.

Parameters:

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 488

def edit_pdf_rasterize_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_rasterize ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_rasterize"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/rasterize"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_rasterize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_set_form_fields(field_values, opts = {}) ⇒ String

Sets ands fills PDF Form field values Fill in the form fields in a PDF form with specific values. Use form/get-fields to enumerate the available fields and their data types in an input form.

Parameters:

  • field_values
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


534
535
536
537
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 534

def edit_pdf_set_form_fields(field_values, opts = {})
  data, _status_code, _headers = edit_pdf_set_form_fields_with_http_info(field_values, opts)
  return data
end

#edit_pdf_set_form_fields_with_http_info(field_values, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Sets ands fills PDF Form field values Fill in the form fields in a PDF form with specific values. Use form/get-fields to enumerate the available fields and their data types in an input form.

Parameters:

  • field_values
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 544

def edit_pdf_set_form_fields_with_http_info(field_values, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_set_form_fields ..."
  end
  # verify the required parameter 'field_values' is set
  if @api_client.config.client_side_validation && field_values.nil?
    fail ArgumentError, "Missing the required parameter 'field_values' when calling EditPdfApi.edit_pdf_set_form_fields"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/form/set-fields"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(field_values)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_set_form_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_set_metadata(request, opts = {}) ⇒ String

Sets PDF document metadata Sets (writes) metadata into the input PDF document, including Title, Author, etc.

Parameters:

  • request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


589
590
591
592
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 589

def (request, opts = {})
  data, _status_code, _headers = (request, opts)
  return data
end

#edit_pdf_set_metadata_with_http_info(request, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Sets PDF document metadata Sets (writes) metadata into the input PDF document, including Title, Author, etc.

Parameters:

  • request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 599

def (request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_set_metadata ..."
  end
  # verify the required parameter 'request' is set
  if @api_client.config.client_side_validation && request.nil?
    fail ArgumentError, "Missing the required parameter 'request' when calling EditPdfApi.edit_pdf_set_metadata"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/set-metadata"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_set_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_set_permissions(owner_password, user_password, input_file, opts = {}) ⇒ String

Encrypt, password-protect and set restricted permissions on a PDF Encrypt a PDF document with a password, and set permissions on the PDF. Set an owner password to control owner (editor/creator) permissions [required], and set a user (reader) password to control the viewer of the PDF [optional]. Set the reader password to null to omit the password. Restrict or allow printing, copying content, document assembly, editing (read-only), form filling, modification of annotations, and degraded printing through document Digital Rights Management (DRM).

Parameters:

  • owner_password

    Password of a owner (creator/editor) of the PDF file (required)

  • user_password

    Password of a user (reader) of the PDF file (optional)

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :encryption_key_length (String)

    Possible values are &quot;128&quot; (128-bit RC4 encryption) and &quot;256&quot; (256-bit AES encryption). Default is 256.

  • :allow_printing (BOOLEAN)

    Set to false to disable printing through DRM. Default is true.

  • :allow_document_assembly (BOOLEAN)

    Set to false to disable document assembly through DRM. Default is true.

  • :allow_content_extraction (BOOLEAN)

    Set to false to disable copying/extracting content out of the PDF through DRM. Default is true.

  • :allow_form_filling (BOOLEAN)

    Set to false to disable filling out form fields in the PDF through DRM. Default is true.

  • :allow_editing (BOOLEAN)

    Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true.

  • :allow_annotations (BOOLEAN)

    Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true.

  • :allow_degraded_printing (BOOLEAN)

    Set to false to disable degraded printing of the PDF through DRM. Default is true.

Returns:

  • (String)


654
655
656
657
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 654

def edit_pdf_set_permissions(owner_password, user_password, input_file, opts = {})
  data, _status_code, _headers = edit_pdf_set_permissions_with_http_info(owner_password, user_password, input_file, opts)
  return data
end

#edit_pdf_set_permissions_with_http_info(owner_password, user_password, input_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Encrypt, password-protect and set restricted permissions on a PDF Encrypt a PDF document with a password, and set permissions on the PDF. Set an owner password to control owner (editor/creator) permissions [required], and set a user (reader) password to control the viewer of the PDF [optional]. Set the reader password to null to omit the password. Restrict or allow printing, copying content, document assembly, editing (read-only), form filling, modification of annotations, and degraded printing through document Digital Rights Management (DRM).

Parameters:

  • owner_password

    Password of a owner (creator/editor) of the PDF file (required)

  • user_password

    Password of a user (reader) of the PDF file (optional)

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :encryption_key_length (String)

    Possible values are &quot;128&quot; (128-bit RC4 encryption) and &quot;256&quot; (256-bit AES encryption). Default is 256.

  • :allow_printing (BOOLEAN)

    Set to false to disable printing through DRM. Default is true.

  • :allow_document_assembly (BOOLEAN)

    Set to false to disable document assembly through DRM. Default is true.

  • :allow_content_extraction (BOOLEAN)

    Set to false to disable copying/extracting content out of the PDF through DRM. Default is true.

  • :allow_form_filling (BOOLEAN)

    Set to false to disable filling out form fields in the PDF through DRM. Default is true.

  • :allow_editing (BOOLEAN)

    Set to false to disable editing in the PDF through DRM (making the PDF read-only). Default is true.

  • :allow_annotations (BOOLEAN)

    Set to false to disable annotations and editing of annotations in the PDF through DRM. Default is true.

  • :allow_degraded_printing (BOOLEAN)

    Set to false to disable degraded printing of the PDF through DRM. Default is true.

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 674

def edit_pdf_set_permissions_with_http_info(owner_password, user_password, input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_set_permissions ..."
  end
  # verify the required parameter 'owner_password' is set
  if @api_client.config.client_side_validation && owner_password.nil?
    fail ArgumentError, "Missing the required parameter 'owner_password' when calling EditPdfApi.edit_pdf_set_permissions"
  end
  # verify the required parameter 'user_password' is set
  if @api_client.config.client_side_validation && user_password.nil?
    fail ArgumentError, "Missing the required parameter 'user_password' when calling EditPdfApi.edit_pdf_set_permissions"
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_set_permissions"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/encrypt/set-permissions"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'ownerPassword'] = owner_password
  header_params[:'userPassword'] = user_password
  header_params[:'encryptionKeyLength'] = opts[:'encryption_key_length'] if !opts[:'encryption_key_length'].nil?
  header_params[:'allowPrinting'] = opts[:'allow_printing'] if !opts[:'allow_printing'].nil?
  header_params[:'allowDocumentAssembly'] = opts[:'allow_document_assembly'] if !opts[:'allow_document_assembly'].nil?
  header_params[:'allowContentExtraction'] = opts[:'allow_content_extraction'] if !opts[:'allow_content_extraction'].nil?
  header_params[:'allowFormFilling'] = opts[:'allow_form_filling'] if !opts[:'allow_form_filling'].nil?
  header_params[:'allowEditing'] = opts[:'allow_editing'] if !opts[:'allow_editing'].nil?
  header_params[:'allowAnnotations'] = opts[:'allow_annotations'] if !opts[:'allow_annotations'].nil?
  header_params[:'allowDegradedPrinting'] = opts[:'allow_degraded_printing'] if !opts[:'allow_degraded_printing'].nil?

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_set_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_watermark_text(watermark_text, input_file, opts = {}) ⇒ String

Add a text watermark to a PDF Adds a text watermark to a PDF

Parameters:

  • watermark_text

    Watermark text to add to the PDF (required)

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :font_name (String)

    Font Family Name for the watermark text; default is Times New Roman

  • :font_size (Float)

    Font Size in points of the text; default is 150

  • :font_color (String)

    Font color in hexadecimal or HTML color name; default is Red

  • :font_transparency (Float)

    Font transparency between 0.0 (completely transparent) to 1.0 (fully opaque); default is 0.5

Returns:

  • (String)


743
744
745
746
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 743

def edit_pdf_watermark_text(watermark_text, input_file, opts = {})
  data, _status_code, _headers = edit_pdf_watermark_text_with_http_info(watermark_text, input_file, opts)
  return data
end

#edit_pdf_watermark_text_with_http_info(watermark_text, input_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Add a text watermark to a PDF Adds a text watermark to a PDF

Parameters:

  • watermark_text

    Watermark text to add to the PDF (required)

  • input_file

    Input file to perform the operation on.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :font_name (String)

    Font Family Name for the watermark text; default is Times New Roman

  • :font_size (Float)

    Font Size in points of the text; default is 150

  • :font_color (String)

    Font color in hexadecimal or HTML color name; default is Red

  • :font_transparency (Float)

    Font transparency between 0.0 (completely transparent) to 1.0 (fully opaque); default is 0.5

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 758

def edit_pdf_watermark_text_with_http_info(watermark_text, input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: EditPdfApi.edit_pdf_watermark_text ..."
  end
  # verify the required parameter 'watermark_text' is set
  if @api_client.config.client_side_validation && watermark_text.nil?
    fail ArgumentError, "Missing the required parameter 'watermark_text' when calling EditPdfApi.edit_pdf_watermark_text"
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling EditPdfApi.edit_pdf_watermark_text"
  end
  # resource path
  local_var_path = "/convert/edit/pdf/watermark/text"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'watermarkText'] = watermark_text
  header_params[:'fontName'] = opts[:'font_name'] if !opts[:'font_name'].nil?
  header_params[:'fontSize'] = opts[:'font_size'] if !opts[:'font_size'].nil?
  header_params[:'fontColor'] = opts[:'font_color'] if !opts[:'font_color'].nil?
  header_params[:'fontTransparency'] = opts[:'font_transparency'] if !opts[:'font_transparency'].nil?

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_watermark_text\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end