Displaying 2 results from an estimated 2 matches for "downloadcontroller".
2008 Oct 26
2
use Prawn to generate pdf
Hello:
when i use Prawn to generate pdf file for download, i got a blank pdf
file, can someone tell me why?
require ''prawn''
class DownloadController < ApplicationController
def download_pdf
send_data(generate_pdf, :filename => ''test.pdf'', :type =>
''application/pdf'')
end
private
def generate_pdf
Prawn::Document.new do |p|
p.text ''Document Name'', :align => &...
2011 Jul 24
4
Downloading files not stored in database?
...se this variable in the send_file
method, instead of specifying a path manually.
Any ideas on how to do this or better suggestions would be great.
Cheers,
Jen.
Below is code from my controller so far. I have commented out the
send_file line for now, so I could test the view rendered ok.
class DownloadController < ApplicationController
require ''grit''
include Grit
#First check the user is logged in
before_filter :authenticate
#First get a list of files from git, so the user can decide what to
download.
def index
download = Download.new
render ''download''
end
def downlo...