generating password protected pdfs using rails - ruby-on-rails

Recently I was looking for some gem which can password protect our existing pdf files.
Basically we are fetching some invoice PDFS from aws . After fetching it from aws , we have to add password to the pdf and send it as an attachment in an email.
I tried with prawn/hexapdf/combined_pdf , but no success. Because with prawn i can not find a way to read an existing pdf. but prawn can easily password encrypt any pdf generated via prawn.
Any suggestion would be greatly appriciated.

Not really a gem, but is it possible to install and use a command line program like pdftk? I've been using it for years for similar problems with great success.

Related

Is there an upgrade gem to prawn to covert odf (.odt)?

I've been using the awesome prawn gem in my last few project, but this time I have to covert a odt file (in odf format) to PDF.
I know that there are many gems that can do this, for example docsplit and others, but since I am already using prawn to generate other PDFs in the same app I would really like to know if I could get a way without adding yet another pdf creator type gem...
Does anyone know any resources that could help? Or at least a (really) simple gem that coverts odt to PDF (without possibly having to install anything)?
Thanks in advance...
No, Prawn can't do that. Prawn is just a library for programmatically generating PDF documents.
Best way would be using LibreOffice in a head-less fashion to convert ODF files into PDF.

How to upload and mail the same attachment file in rails 4?

I am using rails 4.
Can any one please suggest , what is the best way to upload a pdf file and the same time mail this file?
For uploading, you can use the CarrierWave library. Is pretty easy to use. And for sending an Email, you can follow this part of the Rails Tutorial Book which shows you how to setup and send emails.

How should I parse a file in Ruby on Rails to store in a database?

I want to create a simple form for users to upload a file, which will be stored in a database. I also want to display all the submitted files in the database with their name and a link to download the file. Schematically, what's the best way to do this in Rails/how should I store the file in table (which fields should my table have? etc). Thanks!
i would use paperclip gem with the upload to s3 instead of file system
https://github.com/thoughtbot/paperclip
checkout the README, most of the examples are for an image, but works with non-image files as well
use paperclip to upload file, you can store images/file in your database as well as in s3 (AWS)
See below link how to use paperclip in rails with example
Here is the steps how to upload file using paperclip in rails
http://patshaughnessy.net/2009/4/30/paperclip-sample-app
for github
https://github.com/thoughtbot/paperclip
https://github.com/websymphony/Rails3-Paperclip-Uploadify

Word,PDF Upload and download using Rails 3.1.x on windows

Hi I am looking for a very good solution to upload and download document file types directly to and from the database using rails 3.1.x ... I used paperclip for that but image-magick is pain to install on windows..please help me in these... Thanks
If you're not uploading images, you don't need to install image-magick.
As for storing to the database using Paperclip, see this topic.

Can wicked_pdf or wkhtmltopdf generate a protected pdf?

So, I have wicked_pdf up and running, now I am wondering if I can password protect the pdf being generated so it is not easily editable. Is this possible? Perhaps a better question is can wkhtmltopdf generate a protected pdf?
If not, is there a great rails pdf gem or similar that can take an existing pdf and protect it?
Thanks!
Let me check the usage for wkhtmltopdf (v0.10.0 rc2).
Nope, at least not according to it's usage dump. And wicked_pdf just wraps wkhtmltopdf, so you're out of luck.
There are any number of OSS PDF projects floating around out there that could encrypt your PDF output in a second pass.

Resources