Class: RGhost::PdfSecurity
- Inherits:
-
Object
- Object
- RGhost::PdfSecurity
- Defined in:
- lib/rghost/pdf_security.rb
Constant Summary collapse
- PERMISSION_VALUES =
{ :base => -4, :print => -4, :modify => -8, :copy => -16, :annotate => -32, :interactive => -256, :copy_access => -512, :assemble => -1024, :high_quality_print => -2048, :all => -3904 }
Instance Attribute Summary collapse
-
#key_length ⇒ Object
Returns the value of attribute key_length.
-
#owner_password ⇒ Object
Returns the value of attribute owner_password.
-
#user_password ⇒ Object
Returns the value of attribute user_password.
Instance Method Summary collapse
- #disable(*permissions) ⇒ Object
- #gs_params ⇒ Object
-
#initialize ⇒ PdfSecurity
constructor
A new instance of PdfSecurity.
Constructor Details
#initialize ⇒ PdfSecurity
Returns a new instance of PdfSecurity.
17 18 19 20 21 22 |
# File 'lib/rghost/pdf_security.rb', line 17 def initialize @permission_value=PERMISSION_VALUES[:all] @key_lenght=128 @owner_password="unknow" @user_password="unknow" end |
Instance Attribute Details
#key_length ⇒ Object
Returns the value of attribute key_length.
16 17 18 |
# File 'lib/rghost/pdf_security.rb', line 16 def key_length @key_length end |
#owner_password ⇒ Object
Returns the value of attribute owner_password.
16 17 18 |
# File 'lib/rghost/pdf_security.rb', line 16 def owner_password @owner_password end |
#user_password ⇒ Object
Returns the value of attribute user_password.
16 17 18 |
# File 'lib/rghost/pdf_security.rb', line 16 def user_password @user_password end |
Instance Method Details
#disable(*permissions) ⇒ Object
23 24 25 |
# File 'lib/rghost/pdf_security.rb', line 23 def disable(*) @permission_value=.map{|p| PERMISSION_VALUES[p] }.inject(0){|n,i| i+=n} end |
#gs_params ⇒ Object
26 27 28 |
# File 'lib/rghost/pdf_security.rb', line 26 def gs_params "-sOwnerPassword##{clear_space(@owner_password)} -sUserPassword##{clear_space(@user_password)} -dEncryptionR#3 -dKeyLength##{@key_lenght} -dPermissions##{@permission_value}" end |