class EmlToPdfExt::Wkhtmltopdf

Public Class Methods

convert(input, output_path) click to toggle source
# File lib/eml_to_pdf_ext/wkhtmltopdf.rb, line 5
def self.convert(input, output_path)
  IO.popen("wkhtmltopdf --encoding utf-8 --footer-center [page] --footer-spacing 2.5 - #{output_path} 2>&1", "r+") do |pipe|
    pipe.puts(input)
    pipe.close_write
    output = pipe.readlines.join
    pipe.close
    unless $?.success?
      raise ConversionError, output
    end
  end
end