Module: Renalware::Forms::Helpers

Defined in:
lib/renalware/forms/helpers.rb

Instance Method Summary collapse

Instance Method Details

#open_pdf(filename) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/renalware/forms/helpers.rb', line 14

def open_pdf(filename)
  # Open the test file in ubuntu - just use "open" if mac?
  # You may need to fo
  # `sudo apt-get install appmenu-gtk2-module appmenu-gtk3-module`

  `gio open #{filename}`
rescue StandardError
  nil
end

#render_and_open(prawn_pdf_doc) ⇒ Object



8
9
10
11
12
# File 'lib/renalware/forms/helpers.rb', line 8

def render_and_open(prawn_pdf_doc)
  filename = File.join(Dir.pwd, "./tmp", "#{Time.now.to_i}.pdf")
  prawn_pdf_doc.render_file filename
  open_pdf filename
end