Sha256: 6f7f2d0b6ce572967c01740a7bc913cdbe8e49f676a96c477fbe8164cc62a351

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

module EmlToPdfExt
  class Wkhtmltopdf
    class ConversionError < StandardError; end

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eml_to_pdf_ext-0.6.1 lib/eml_to_pdf_ext/wkhtmltopdf.rb
eml_to_pdf_ext-0.6.0 lib/eml_to_pdf_ext/wkhtmltopdf.rb