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_add_annotations(request, opts = {}) ⇒ String

Add one or more PDF annotations, comments in the PDF document Adds one or more annotations, comments to a PDF document.

Parameters:

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

    the optional parameters

Returns:

  • (String)


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

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

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

Add one or more PDF annotations, comments in the PDF document Adds one or more annotations, comments to a PDF document.

Parameters:

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



37
38
39
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 37

def edit_pdf_add_annotations_with_http_info(request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_add_annotations ...'
  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_add_annotations"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/annotations/add-item'

  # 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_add_annotations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#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)


82
83
84
85
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 82

def edit_pdf_decrypt(password, input_file, opts = {})
  data, _status_code, _headers = edit_pdf_decrypt_with_http_info(password, input_file, opts)
  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



93
94
95
96
97
98
99
100
101
102
103
104
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 93

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)


145
146
147
148
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 145

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)
  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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 157

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)


215
216
217
218
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 215

def edit_pdf_encrypt(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_encrypt_with_http_info(input_file, opts)
  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



228
229
230
231
232
233
234
235
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 228

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_annotations(input_file, opts = {}) ⇒ GetPdfAnnotationsResult

Get PDF annotations, including comments in the document Enumerates the annotations, including comments and notes, in a PDF document.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Returns:



276
277
278
279
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 276

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

#edit_pdf_get_annotations_with_http_info(input_file, opts = {}) ⇒ Array<(GetPdfAnnotationsResult, Fixnum, Hash)>

Get PDF annotations, including comments in the document Enumerates the annotations, including comments and notes, in a PDF document.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Returns:

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

    GetPdfAnnotationsResult data, response status code and response headers



286
287
288
289
290
291
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 286

def edit_pdf_get_annotations_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_get_annotations ...'
  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_annotations"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/annotations/list'

  # 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 => 'GetPdfAnnotationsResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditPdfApi#edit_pdf_get_annotations\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:



331
332
333
334
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 331

def edit_pdf_get_form_fields(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_get_form_fields_with_http_info(input_file, opts)
  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



341
342
343
344
345
346
347
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 341

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:



386
387
388
389
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 386

def (input_file, opts = {})
  data, _status_code, _headers = (input_file, opts)
  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



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 396

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

Options Hash (opts):

  • :text_formatting_mode (String)

    Optional; specify how whitespace should be handled when converting the document to text. Possible values are &#39;preserveWhitespace&#39; which will attempt to preserve whitespace in the document and relative positioning of text within the document, and &#39;minimizeWhitespace&#39; which will not insert additional spaces into the document in most cases. Default is &#39;preserveWhitespace&#39;.

Returns:



442
443
444
445
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 442

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)
  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

Options Hash (opts):

  • :text_formatting_mode (String)

    Optional; specify how whitespace should be handled when converting the document to text. Possible values are &#39;preserveWhitespace&#39; which will attempt to preserve whitespace in the document and relative positioning of text within the document, and &#39;minimizeWhitespace&#39; which will not insert additional spaces into the document in most cases. Default is &#39;preserveWhitespace&#39;.

Returns:

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

    PdfTextByPageResult data, response status code and response headers



453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 453

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'])
  header_params[:'textFormattingMode'] = opts[:'text_formatting_mode'] if !opts[:'text_formatting_mode'].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 => '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)


503
504
505
506
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 503

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)
  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



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 517

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)


582
583
584
585
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 582

def edit_pdf_rasterize(input_file, opts = {})
  data, _status_code, _headers = edit_pdf_rasterize_with_http_info(input_file, opts)
  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



592
593
594
595
596
597
598
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
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 592

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_remove_all_annotations(input_file, opts = {}) ⇒ String

Remove all PDF annotations, including comments in the document Removes all of the annotations, including comments and notes, in a PDF document.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Returns:

  • (String)


637
638
639
640
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 637

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

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

Remove all PDF annotations, including comments in the document Removes all of the annotations, including comments and notes, in a PDF document.

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



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 647

def edit_pdf_remove_all_annotations_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_remove_all_annotations ...'
  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_remove_all_annotations"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/annotations/remove-all'

  # 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_remove_all_annotations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_remove_annotation_item(input_file, annotation_index, opts = {}) ⇒ String

Remove a specific PDF annotation, comment in the document Removes a specific annotation in a PDF document, using the AnnotationIndex. To enumerate AnnotationIndex for all of the annotations in the PDF document, use the /edit/pdf/annotations/list API.

Parameters:

  • input_file

    Input file to perform the operation on.

  • annotation_index

    The 0-based index of the annotation in the document

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

    the optional parameters

Returns:

  • (String)


693
694
695
696
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 693

def edit_pdf_remove_annotation_item(input_file, annotation_index, opts = {})
  data, _status_code, _headers = edit_pdf_remove_annotation_item_with_http_info(input_file, annotation_index, opts)
  data
end

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

Remove a specific PDF annotation, comment in the document Removes a specific annotation in a PDF document, using the AnnotationIndex. To enumerate AnnotationIndex for all of the annotations in the PDF document, use the /edit/pdf/annotations/list API.

Parameters:

  • input_file

    Input file to perform the operation on.

  • annotation_index

    The 0-based index of the annotation in the document

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 704

def edit_pdf_remove_annotation_item_with_http_info(input_file, annotation_index, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_remove_annotation_item ...'
  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_remove_annotation_item"
  end
  # verify the required parameter 'annotation_index' is set
  if @api_client.config.client_side_validation && annotation_index.nil?
    fail ArgumentError, "Missing the required parameter 'annotation_index' when calling EditPdfApi.edit_pdf_remove_annotation_item"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/annotations/remove-item'

  # 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[:'annotationIndex'] = annotation_index

  # 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_remove_annotation_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_resize(input_file, paper_size, opts = {}) ⇒ String

Change PDF Document’s Paper Size Resizes a PDF document’s paper size.

Parameters:

  • input_file

    Input file to perform the operation on.

  • paper_size

    The desired paper size for the resized PDF document. Size ranges from A7 (smallest) to A0 (largest).

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

    the optional parameters

Returns:

  • (String)


755
756
757
758
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 755

def edit_pdf_resize(input_file, paper_size, opts = {})
  data, _status_code, _headers = edit_pdf_resize_with_http_info(input_file, paper_size, opts)
  data
end

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

Change PDF Document&#39;s Paper Size Resizes a PDF document&#39;s paper size.

Parameters:

  • input_file

    Input file to perform the operation on.

  • paper_size

    The desired paper size for the resized PDF document. Size ranges from A7 (smallest) to A0 (largest).

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
807
808
809
810
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 766

def edit_pdf_resize_with_http_info(input_file, paper_size, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_resize ...'
  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_resize"
  end
  # verify the required parameter 'paper_size' is set
  if @api_client.config.client_side_validation && paper_size.nil?
    fail ArgumentError, "Missing the required parameter 'paper_size' when calling EditPdfApi.edit_pdf_resize"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/resize'

  # 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[:'paperSize'] = paper_size

  # 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_resize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#edit_pdf_rotate_all_pages(input_file, rotation_angle, opts = {}) ⇒ String

Rotate all pages in a PDF document Rotate all of the pages in a PDF document by a multiple of 90 degrees

Parameters:

  • input_file

    Input file to perform the operation on.

  • rotation_angle

    The angle to rotate the page in degrees, must be a multiple of 90 degrees, e.g. 90, 180, 270, or -90, -180, -270, etc.

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

    the optional parameters

Returns:

  • (String)


817
818
819
820
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 817

def edit_pdf_rotate_all_pages(input_file, rotation_angle, opts = {})
  data, _status_code, _headers = edit_pdf_rotate_all_pages_with_http_info(input_file, rotation_angle, opts)
  data
end

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

Rotate all pages in a PDF document Rotate all of the pages in a PDF document by a multiple of 90 degrees

Parameters:

  • input_file

    Input file to perform the operation on.

  • rotation_angle

    The angle to rotate the page in degrees, must be a multiple of 90 degrees, e.g. 90, 180, 270, or -90, -180, -270, etc.

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 828

def edit_pdf_rotate_all_pages_with_http_info(input_file, rotation_angle, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_rotate_all_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_rotate_all_pages"
  end
  # verify the required parameter 'rotation_angle' is set
  if @api_client.config.client_side_validation && rotation_angle.nil?
    fail ArgumentError, "Missing the required parameter 'rotation_angle' when calling EditPdfApi.edit_pdf_rotate_all_pages"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/pages/rotate/all'

  # 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[:'rotationAngle'] = rotation_angle

  # 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_rotate_all_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Rotate a range, subset of pages in a PDF document Rotate a range of specific pages in a PDF document by a multiple of 90 degrees

Parameters:

  • input_file

    Input file to perform the operation on.

  • rotation_angle

    The angle to rotate the page in degrees, must be a multiple of 90 degrees, e.g. 90, 180, 270, or -90, -180, -270, etc.

  • page_start

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

  • page_end

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

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

    the optional parameters

Returns:

  • (String)


881
882
883
884
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 881

def edit_pdf_rotate_page_range(input_file, rotation_angle, page_start, page_end, opts = {})
  data, _status_code, _headers = edit_pdf_rotate_page_range_with_http_info(input_file, rotation_angle, page_start, page_end, opts)
  data
end

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

Rotate a range, subset of pages in a PDF document Rotate a range of specific pages in a PDF document by a multiple of 90 degrees

Parameters:

  • input_file

    Input file to perform the operation on.

  • rotation_angle

    The angle to rotate the page in degrees, must be a multiple of 90 degrees, e.g. 90, 180, 270, or -90, -180, -270, etc.

  • page_start

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

  • page_end

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

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 894

def edit_pdf_rotate_page_range_with_http_info(input_file, rotation_angle, page_start, page_end, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_rotate_page_range ...'
  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_rotate_page_range"
  end
  # verify the required parameter 'rotation_angle' is set
  if @api_client.config.client_side_validation && rotation_angle.nil?
    fail ArgumentError, "Missing the required parameter 'rotation_angle' when calling EditPdfApi.edit_pdf_rotate_page_range"
  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_rotate_page_range"
  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_rotate_page_range"
  end
  # resource path
  local_var_path = '/convert/edit/pdf/pages/rotate/page-range'

  # 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[:'rotationAngle'] = rotation_angle
  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_rotate_page_range\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)


954
955
956
957
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 954

def edit_pdf_set_form_fields(field_values, opts = {})
  data, _status_code, _headers = edit_pdf_set_form_fields_with_http_info(field_values, opts)
  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



964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 964

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)


1008
1009
1010
1011
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 1008

def (request, opts = {})
  data, _status_code, _headers = (request, opts)
  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



1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 1018

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)


1072
1073
1074
1075
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 1072

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)
  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



1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 1092

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)


1160
1161
1162
1163
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 1160

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)
  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



1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
# File 'lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb', line 1175

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