PDF Security - shairontoledo/rghost GitHub Wiki

Set passwords to allow user make actions with document


 doc.security do |sec|
   sec.owner_password ="testXXX"
   sec.user_password ="testYYY"
   sec.disable :print, :copy
 end

The code above, we are disabling print and content copy. Now disabling everything


doc.security do |sec|
sec.owner_password =โ€œtest123โ€
sec.user_password =โ€œtest567โ€
sec.disable :all
end

When open the document the password will be necessary

Disable options

  • :base or :print โ€“ Print document (possibly not at the highest quality level).
  • modify โ€“ Modify contents of document, except as controlled by :annotate, :interective and :assemble.
  • :copy โ€“ Copy text and graphics from document other than that controlled by :copy_access
  • :annotate โ€“ Add or modify text annotations, fill in interactive form fields, and if :interective is set, create or modify interactive form fields
  • :interactive โ€“ Fill in existing interacive form fields, even if :annotate is clear
  • :copy_access โ€“ Extract text and graphics (in support of accessibility to disabled users or for other purposes).
  • :assemble โ€“ Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even when :base is clear
  • :high_quality_print โ€“ Add or modify text annotations
  • :all โ€“ Disable all permissions.
โš ๏ธ **GitHub.com Fallback** โš ๏ธ