Report generation in rails 3 from query results - ruby-on-rails

I want to generate reports in ruby on rails from any database table or result of join of two tables.
reports should be in different formats such as : pdf ,excel ,csv ,html etc..
Is this possible in rails 3.2.6.???
I know the ruport gem but don't know how to use it...

You can use a gem like Prawn. There's also a Railscast on how to get started, it's quite simple.

There are various gems are available for different kind of reports like below:
pdf - pdfkit gem, wkhtmltopdf gem, pdftk plugin
https://rubygems.org/gems/wkhtmltopdf
http://rubygems.org/gems/pdfkit
excel - spreadsheet gem
https://rubygems.org/gems/spreadsheet
csv - csv gem
http://rubygems.org/gems/fastercsv
etc..
You can use or utilize as per your requirements.

Related

Is there any way that we can export(generate) editable PDFs in ROR?

I tried looking for different gem including wicked PDF, prawn, prawn forms, pdf-forms etc gems to enable a user to export editable PDFs but these gems weren't helpful. Can anyone guide me about any other gem or plugins that could be used for this purpose.
What you are searching is AcroForm / PDF Interactive Form. You can use PDFTron or Origami. I was using origami gems.
For PDFTron, you can check start from here and here.
For origami you can start from here.
There are hardly any documentation for both, so you have to try a lot until it works like what you want.
I used origami because it is just a gem. Unlike pdftron, I don't have to install anything.

creating xls files with images in ruby (UNIX)

I am trying to create a xls file which includes charts with Ruby. We run ruby on rails in Unix environment(Debian). We currently use Spreadsheet gem. But this gem doesn't seem to have chart capability. Looks like Win32ole gem is for Windows only. Axlsx is more what I need but it works with xlsx files. Anyone know a better way of doing this? Thanks!
The writeexcel gem (github) supports xls and charts.

PDF (Prawn) : Generate tables without Prawnto

For some permission restriction, I can't install prawnto gem to my server. I used the method of http://blog.idyllic-software.com/blog/bid/204082/Creating-PDF-using-Prawn-in-Ruby-on-Rails to generate PDF for my object.
But, I used the method pdf.table to generate table, and this method is not accessible since I've remove prawnto.
Is there any method accessible to easily generate tables just with prawn gem ?
My application is on Rails 2.3.16, and prawn version 0.8.4.
Regards
Is there any reason to use prawn 0.8.4? If not then try to upgrade to latest prawn.
I am using prawn 0.12.0 and I can generate tables using pdf.table without prawnto gem.

Gem for surveys with images on RoR

I am a newbie on RoR and I am looking for a GEM that would create surveys and support images. I have tried Surveyor and it seems great for text only surveys (I will definitely use it again for surveys). Ideas?
Easiest way would be to generate the HTML with that gem, then use the generated HTML and put it in the html.erb and update it with the images.
You can look at the generated HTML with developer tools on your browser.
Otherwise, you will have to write it yourself or add new methods to that gem.

Pdf generation with latex in rails 3

is there a way to generate pdf documents from latex in rails 3? We've been using rtex (http://rtex.rubyforge.org/) in a rails 2 application, however it doesen't seem to work with rails 3.
Our rails application generates invoices using a latex template which we also use to create invoices by hand. Hence we would have to maintain two templates if we had to find a different solution for the pdf generation in rails 3.
Best I found to do such things was to create the .tex files on the server, then call a rake task that ran a "pdflatex" system command.
It is pretty poor in performances I guess, but it's designed for a single admin and works fine for me, on my local machine, and I can use the same latex templates for my letters
Old question, but I'm sure this'll help anyone coming to this page now.
Take a look at the rails-latex (LatexToPdf) gem.
The LatexToPdf.generate_pdf method takes in two arguments:
tex content
a configuration hash
...and returns the pdf binary, which you'll have to write to a file.
I suggest reading through the source to if you need to add configuration.
Note that under the hood, the rails-latex gem still depends on a TeX extension (which you'll need to download) to generate the pdf. The default is pdflatex, and I've personally used xelatex.
As of the writing of this answer, this gem is described as a renderer for rails 3; though it now includes support for rails 4 and 5.

Resources