Class: DynamicPDFApi::RC4128Security

Inherits:
Security
  • Object
show all
Defined in:
lib/ruby_client/RC4128Security.rb

Overview

Represents RC4 128 bit PDF document security.

RC4 128 bit PDF security, with UseCryptFilter property set to false is compatible with PDF version 1.4 or higher and can be read with Adobe Acrobat Reader version 5 or higher. By default UseCryptFilter property is false. RC4 128 bit PDF security with crypt filter is compatible with PDF version 1.5 or higher and can be read with Adobe Acrobat Reader version 6 and higher. Older readers will not be able to read document encrypted with this security.

Instance Attribute Summary collapse

Attributes inherited from Security

#allow_accessibility, #allow_copy, #allow_document_assembly, #allow_edit, #allow_form_filling, #allow_high_resolution_printing, #allow_print, #allow_update_annots_and_fields, #owner_password, #user_password

Instance Method Summary collapse

Constructor Details

#initialize(user_password, owner_password) ⇒ RC4128Security

Initializes a new instance of the RC4128Security class.

Parameters:

  • owner_password (String)

    The owner password to open the document.

  • user_password (String)

    The user password to open the document.



21
22
23
24
25
# File 'lib/ruby_client/RC4128Security.rb', line 21

def initialize(user_password, owner_password)
  @_type = SecurityType::RC_4128
  super(user_password, owner_password)
  @encrypt_metadata = nil
end

Instance Attribute Details

#encrypt_metadataObject

Gets or sets the documents components to be encrypted.



30
31
32
# File 'lib/ruby_client/RC4128Security.rb', line 30

def 
  @encrypt_metadata
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ruby_client/RC4128Security.rb', line 32

def to_json(_options = {})
  json_array = {}
  json_array['type'] = 'rc4128'

  json_array['encryptMetadata'] = @encrypt_metadata unless @encrypt_metadata.nil?

  #-------------------------------------------
  json_array['allowCopy'] = @allow_copy unless @allow_copy.nil?

  json_array['allowEdit'] = @allow_edit unless @allow_edit.nil?

  json_array['allowPrint'] = @allow_print unless @allow_print.nil?

  json_array['allowUpdateAnnotsAndFields'] = @allow_update_annots_and_fields unless @allow_update_annots_and_fields.nil?

  json_array['ownerPassword'] = @owner_password unless @owner_password.nil?

  json_array['userPassword'] = @user_password unless @user_password.nil?

  json_array['allowAccessibility'] = @allow_accessibility unless @allow_accessibility.nil?

  json_array['allowFormFilling'] = @allow_form_filling unless @allow_form_filling.nil?

  json_array['allowHighResolutionPrinting'] = @allow_high_resolution_printing unless @allow_high_resolution_printing.nil?

  json_array['allowDocumentAssembly'] = @allow_document_assembly unless @allow_document_assembly.nil?

  JSON.pretty_generate(json_array)
end