lib/wicked_pdf.rb in wicked_pdf-0.9.2 vs lib/wicked_pdf.rb in wicked_pdf-0.9.3
- old
+ new
@@ -11,10 +11,11 @@
require 'active_support/core_ext/object/blank'
rescue LoadError
require 'active_support/core_ext/blank'
end
+require 'wicked_pdf_version'
require 'wicked_pdf_railtie'
require 'wicked_pdf_tempfile'
require 'wicked_pdf_middleware'
class WickedPdf
@@ -28,15 +29,15 @@
raise "Bad #{EXE_NAME}'s path" unless File.exists?(@exe_path)
raise "#{EXE_NAME} is not executable" unless File.executable?(@exe_path)
end
def pdf_from_string(string, options={})
- string_file = WickedPdfTempfile.new("wicked_pdf.html")
+ temp_path = options.delete(:temp_path)
+ string_file = WickedPdfTempfile.new("wicked_pdf.html", temp_path)
string_file.write(string)
string_file.close
-
- generated_pdf_file = WickedPdfTempfile.new("wicked_pdf_generated_file.pdf")
- command = "\"#{@exe_path}\" #{'-q ' unless on_windows?}#{parse_options(options)} \"file://#{string_file.path}\" \"#{generated_pdf_file.path}\" " # -q for no errors on stdout
+ generated_pdf_file = WickedPdfTempfile.new("wicked_pdf_generated_file.pdf", temp_path)
+ command = "\"#{@exe_path}\" #{'-q ' unless on_windows?}#{parse_options(options)} \"file:///#{string_file.path}\" \"#{generated_pdf_file.path}\" " # -q for no errors on stdout
print_command(command) if in_development_mode?
err = Open3.popen3(command) do |stdin, stdout, stderr|
stderr.read
end
generated_pdf_file.rewind