Project

go_static

0.0
No commit activity in last 3 years
No release in over 3 years
GoStatic uses the shell utility wkhtmltoimage to serve an image file to a user from HTML. You simply write an HTML view as you would normally, and let GoStatic take care of the hard stuff.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

GoStatic

An image generation plugin for Ruby on Rails

GoStatic uses the shell utility wkhtmltoimage to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, then let Wicked take care of the hard stuff.

GoStatic has been verified to work on Ruby 1.8.7 and 1.9.2; Rails 2 and Rails 3

Installation

First, be sure to install wkhtmltoimage version 0.10.0.rc2. This plugin relies on streams to communicate with wkhtmltoimage.

More information about wkhtmltoimage could be found here.

Next:

script/plugin install git://github.com/lleirborras/go_static.git
script/generate go_static

or add this to your Gemfile:

gem 'go_static'

Basic Usage

class ThingsController < ApplicationController
  def show
    respond_to do |format|
      format.html
      format.png do
        render :png => "file_name"
      end
    end
  end
end

Advanced Usage with all available options

class ThingsController < ApplicationController
  def show
    respond_to do |format|
      format.html
      format.png do
        render :png                            => 'file_name',
               :disposition	                   => 'attachment'                 # default 'inline'                   
      end
    end
  end
end

By default, it will render without a layout (:layout => false) and the template for the current controller and action.