Skip to content

Instantly share code, notes, and snippets.

@mgswolf
Created October 29, 2012 17:11
Show Gist options
  • Save mgswolf/3974951 to your computer and use it in GitHub Desktop.
Save mgswolf/3974951 to your computer and use it in GitHub Desktop.
example use of pdf-kit
# your controller
def export_pdf
html = render :layout => 'print' #or false
kit = PDFKit.new(html)
kit.stylesheets << "#{Rails.root/app/assets/stylesheets/print.css"
send_data(kit.to_pdf, :filename => "your_pdf_name.pdf", :type => 'application/pdf')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment