Hi,
Recently for one of the requirement in my project I was supposed to create the pdf report in the rails application. I have made some research and found the "wicked_pdf" is one of the best gem available in rails.
wicked_pdf makes the life easy for pdf file generation directly from HTML page.
Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML.
Wicked PDF works on Ruby 1.8.7 and 1.9.2; Rails 2 and Rails 3.
In order to use the wicked_pdf you need to install wkhtmltopdf from http://code.google.com/p/wkhtmltopdf/
next add this to your Gemfile
gem 'wicked_pdf'
You can get the gem from : https://github.com/umamahesh/wicked_pdf
In your controller:
class HomeController < ApplicationController
def get_pdf
respond_to do |format|
format.html
format.pdf do
render :pdf => "pdf_file"
end
end
end
end
There are buch of options avilable to make the pdf file look and feel nicely. You can have the clear information at https://github.com/umamahesh/wicked_pdf
Use it and let me know your comments on this gem.
One more things, if you are going to deploy application in heroku then this gem will not be usefull as heroku will not provide the option to install the wkhtmltopdf :(
You may need to use prawn gem for that.
Thank You,
Uma Mahesh.
Recently for one of the requirement in my project I was supposed to create the pdf report in the rails application. I have made some research and found the "wicked_pdf" is one of the best gem available in rails.
wicked_pdf makes the life easy for pdf file generation directly from HTML page.
Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML.
Wicked PDF works on Ruby 1.8.7 and 1.9.2; Rails 2 and Rails 3.
In order to use the wicked_pdf you need to install wkhtmltopdf from http://code.google.com/p/wkhtmltopdf/
next add this to your Gemfile
gem 'wicked_pdf'
You can get the gem from : https://github.com/umamahesh/wicked_pdf
In your controller:
class HomeController < ApplicationController
def get_pdf
respond_to do |format|
format.html
format.pdf do
render :pdf => "pdf_file"
end
end
end
end
There are buch of options avilable to make the pdf file look and feel nicely. You can have the clear information at https://github.com/umamahesh/wicked_pdf
Use it and let me know your comments on this gem.
One more things, if you are going to deploy application in heroku then this gem will not be usefull as heroku will not provide the option to install the wkhtmltopdf :(
You may need to use prawn gem for that.
Thank You,
Uma Mahesh.
No comments:
Post a Comment