I would recommend Prawn for PDF generation--it can do security measures like a password.
Here is the link for more information https://github.com/prawnpdf/prawn
Put gem 'prawn'
in your Gemfile to install it.
Security information: https://github.com/prawnpdf/prawn/tree/master/manual/security