prawn

Generate pdf from Rails 3 - what tool to choose?

◇◆丶佛笑我妖孽 提交于 2019-11-29 13:36:05
问题 I need to be able to render some views as PDFs from a Rails 3 project. I've never before used PDF generation techniques with ruby/rails, so I researched a few popular approaches such as Prawn and PDF::Writer , but all the examples and articles I found so far seem outdated and only applicable for rails 2.x. I haven't yet seen a working Rails3 example; tried myself installing prawn and the prawnto gems and reproducing the example described in this Railscasts episode, but I'm getting error of

header and footer in Prawn PDF

对着背影说爱祢 提交于 2019-11-28 16:32:56
I have read through all relevant posts on Prawn but found no mentioning (even in Prawn's own documentation) of headers and footers. However, I did see a demo on Prawnto's own website about headers and footers. I copied the entire source of that demo just to see if it works but an error of undefined method "header" is complained about. Am I to understand that Prawn took out header and footer recently in the gem or is there something else I need to do first to use header and footer? The demo page: http://cracklabs.com/prawnto/code/prawn_demos/source/text/flowing_text_with_header_and_footer the

Rails, Prawn - PDF show up in browser & etc

 ̄綄美尐妖づ 提交于 2019-11-28 04:11:58
I'm trying to understand the Prawn pdf gem. I was able to make it generate a pdf. Every gem in the gemfile included: gem 'mysql', '~> 2.8.1' gem 'prawn', '~> 0.12.0' gem 'pdf-reader', '~> 0.10.0' gem 'Ascii85', '~> 1.0.1' In the config/application.rb: config.autoload_paths << "#{Rails.root}/app/reports" Then in the controller: require 'prawn' def index pdf = Prawn::Document.new pdf.text "Hello World" pdf.render_file "x.pdf" end Than I call the index function. A PDF named x.pdf is created in the root of my application. Amongst the gemfile, rakefile and config.ru. Question: How can I force prawn