rails form to pdf and save to amazon s3 - ruby-on-rails

I have a form for users to fill out about specific attributes first_name,last_name etc.
I need to generate a pdf from this form and also send an email with the pdf of the form as an attachment.
My approach was to save it to Amazon S3 and somehow attach it in the create method in my controller.
Any input would be greatly appreciated!

You will probably need to use something like the prawn gem https://github.com/prawnpdf/prawn . This will allow you to generate a PDF file from within your application. Your question is somewhat vague though, but you should be able to generate the PDF fairly easily using prawn

Related

configure paperclip to generate styles when they are requested

I need a user to upload an original file and process that into a thumbnail (paperclip's got this - check).
Then I would like to be able to retrieve different styles for that attachment, but I do not need to store those different styles on disk anywhere. I would prefer they are generated during the request.
The reason for that is that these styles are single-use. So, paperclip becomes a glorified one-time-use image resiszer. I'd prefer not to incur the S3 cost if I don't have to.
Wondering if there'a way to do this out of the box. Or, maybe carrierwave supports something like this?
Thanks!
I'm pretty sure that the Refile library supports it. Refile is basically a modern version of the Carrierwave, written by the same author.
You can read more about the on-the-fly processing here:
https://github.com/refile/refile#processing

Email editor with image upload feature Rails

I am developing an app for an Organization that wants to send bulk emails (newsletters).
I need to create an interface to compose emails with image embed feature. I can use TInyMCE. But I dont know what to do to upload images and attach them in email and send them properly.
I saw MoxieManager. But Is it compatible with rails and if so how to do it.
Please help me how to solve this.
Thank you.
You could base64 encode your images and insert them into the content directly.
All you would need for this is a small custom plugin (which is not that difficult to write).
One option would be to use Paperclip or Carrierwave to dump them in an S3 bucket and just use img tags in the HTML part of the email.
The process would be
User uploads using TinyMCE
Controller attaches image files to the newsletter model whilst storing them on S3
Email send method does a substitution so that the names of images in the HTML text that TinyMCE added in the img tags are swapped out for the correct S3 urls.

Uploaded timestamp with Carrierwave

I have a model containing several PDFs that are stored on S3 using Carrierwave, and would like to display the uploaded_at timestamp of these files in a view.
I don't see any way to accomplish this built into Carrierwave. Right now I plan to add an uploaded_timestamp field to the model, but am looking for a more elegant way to accomplish this.
Suggestions welcome.

How to generate excel report in rails 3 and send it to email

I want to generate excel sheet from data in the database models
I want the feature to custom headings
I want to download from browser
I want to send it to email
Is there any gem for doing this requirement
You can use axlsx gem for generating the xls documents
these are few links
https://github.com/randym/axlsx
http://axlsx.blog.randym.net/
http://rubygems.org/gems/axlsx
May this help you
Try axlsx. It's a very good spread sheet generator.
Downloading and email can be done with Rails. No need for other gem.
I work at Expected Behavior, and we've created a web app called DocRaptor that converts HTML to Excel. DocRaptor is a subscription based product, but we offer a free plan that allows users to create up to 5 documents per month.
Since you mention wanting custom headers, I figured it might be a good fit.
Here's a link to a Switch on the Code blog about using DocRaptor to generate Excel files:
http://www.switchonthecode.com/tutorials/using-doc-raptor-to-create-excel-spreadsheets
And a link to DocRaptor's home page:
http://docraptor.com/

Creating a table entry while using CarrierWaveDirect

Is it possible to use something like CarrierWaveDirect to upload directly to S3 and still be able to gather some data on the files being uploaded?
For instance, is it possible to change the filename, and save the size in a table before/after the upload? I don't need to do any kind of manipulation to the file either (I was reading some documentation regarding the use of Resque).
I realize that this is a very novice question but I couldn't find the answer anywhere.
After a lot of fiddling, I found out that the S3 secure upload form that the hidden field success_action_redirect returns so params on the uploaded file.

Resources