Permalink
Browse files

fixed url is not proper it will generate pdf as url name

  • Loading branch information...
1 parent 3e95e6e commit ce9e0fb8b382a9e3adaf909979e3e097f9c5b37c Amar Daxini committed Oct 31, 2011
View
@@ -120,7 +120,7 @@ Ruby
include ActsAsFlyingSaucer::Controller
acts_as_flying_saucer
def generate_pdf(input_file_html_or_string,output_pdf)
- options = ActsAsFlyingSaucer::Config.options.merge({:url=>input_file_html_or_string,:output_file=>output_pdf})
+ options = ActsAsFlyingSaucer::Config.options.merge({:url=>input_file_html_or_string,:pdf_file=>output_pdf})
render_pdf(options)
end
end
@@ -3,6 +3,8 @@
require 'acts_as_flying_saucer/acts_as_flying_saucer_controller'
require 'nailgun'
require 'tidy_ffi'
+require 'net/http'
+require 'uri'
if defined?(Rails)
ActionController::Base.send(:include, ActsAsFlyingSaucer::Controller)
elsif defined?(Sinatra)
@@ -34,7 +34,7 @@ def render_pdf(options = {})
if options[:url]
tidy_clean = true
if options[:url].match(/\Ahttp/)
- response = Net::HTTP.get_response(URI.parse(options[:url]))
+ html = Net::HTTP.get_response(URI.parse(options[:url])).body rescue options[:url]
elsif File.exist?(options[:url])
html = File.read(options[:url]) rescue ""
else

0 comments on commit ce9e0fb

Please sign in to comment.