Hello all, I''m trying to generate a PDF from Rails. I consulted the documentation here: http://wiki.rubyonrails.com/rails/show/HowtoGeneratePDFs but the code doesn''t seem to work. I have the following controller: require ''pdfwriter.rb'' class FooController < ApplicationController def foo if @request.env[''HTTP_USER_AGENT''] =~ /msie/i @headers[''Pragma''] = '''' @headers[''Cache-Control''] = '''' else @headers[''Pragma''] = ''no-cache'' @headers[''Cache-Control''] = ''no-cache, must-revalidate'' end send_data foo_pdf, :filename => "foo.pdf", :type => "application/pdf" render_without_layout end private def foo_pdf pdf = PdfWriter.new pdf.newPage pdf.writeText(10, 200, ''Text to write'', :fontsize => 18) pdf.writeEnd end end However, this gives me the following error when running with WEBrick: #<RuntimeError: bad header ''"%PDF-1.3\n"''.> ["/usr/lib/ruby/1.8/webrick/httputils.rb:143:in `parse_header''", "/usr/lib/ruby/1.8/webrick/httputils.rb:129:in `each''", "/usr/lib/ruby/1.8/webrick/httputils.rb:129:in `parse_header''", "/usr/lib/ruby/gems/1.8/gems/rails-0.12.1/lib/webrick_server.rb:91:in `handle_dispatch''", "/usr/lib/ruby/gems/1.8/gems/rails-0.12.1/lib/webrick_server.rb:35:in `service''", "/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service''", "/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run''", "/usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread''", "/usr/lib/ruby/1.8/webrick/server.rb:144:in `start''", "/usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread''", "/usr/lib/ruby/1.8/webrick/server.rb:94:in `start''", "/usr/lib/ruby/1.8/webrick/server.rb:89:in `each''", "/usr/lib/ruby/1.8/webrick/server.rb:89:in `start''", "/usr/lib/ruby/1.8/webrick/server.rb:79:in `start''", "/usr/lib/ruby/1.8/webrick/server.rb:79:in `start''", "/usr/lib/ruby/gems/1.8/gems/rails-0.12.1/lib/webrick_server.rb:21:in `dispatch''", "script/server:48"] Any help would be appreciated. Thanks. Regards, Albert P.S. The Ruby FPDF site seems to be down at the moment, so I haven''t tried it yet.