lib/princely/pdf_helper.rb in drnic-princely-1.2.3 vs lib/princely/pdf_helper.rb in drnic-princely-1.2.5

- old
+ new

@@ -20,19 +20,20 @@ def make_pdf(options = {}) options[:stylesheets] ||= [] options[:layout] ||= false options[:template] ||= File.join(controller_path,action_name) - + options[:additional_options] ||= '' prince = Princely.new() # Sets style sheets on PDF renderer + prince.additional_options = options[:additional_options] prince.add_style_sheets(*options[:stylesheets].collect{|style| stylesheet_file_path(style)}) html_string = render_to_string(:template => options[:template], :layout => options[:layout]) # Make all paths relative, on disk paths... html_string.gsub!(".com:/",".com/") # strip out bad attachment_fu URLs - html_string.gsub!( /src=["']+([^:]+?)["']/i ) { |m| "src=\"#{RAILS_ROOT}/public/" + $1 + '"' } # re-route absolute paths + # html_string.gsub!( /src=["']+([^:]+?)["']/i ) { |m| "src=\"#{RAILS_ROOT}/public/" + $1 + '"' } # re-route absolute paths # Remove asset ids on images with a regex html_string.gsub!( /src=["'](\S+\?\d*)["']/i ) { |m| 'src="' + $1.split('?').first + '"' } # Send the generated PDF file from our html string.