render_as_pdf
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:A very easy way to generate pdf's in a Rails application.
Lleïr Borràs i Metje


This is a plugin that helps you generating pdf files. Php is needed to run it.

This plugin uses http://html2pdf.spipu.net/

I will put some more info, but here is an example.

##config/environment.rb
require 'render_as_pdf'

##CONTROLLER
class ReportsController < ApplicationController
  def show
    @report = Report.find(params[:id])

    respond_to do |format|
      format.pdf{
        pdf_data=render_as_pdf(:template => "/cens/show.html.erb" , :layout => false)
        send_data(pdf_data, :type => "application/pdf", :filename => "some_name.pdf")
      }
    end
  end
end

##VIEW



  
    Here your header<-->
  

  
    Here your footer<-->
  

  Here your data<-->


本源码包内暂不包含可直接显示的源代码文件,请下载源码包。