Class: Riven::Wkhtmltopdf
- Inherits:
-
Object
- Object
- Riven::Wkhtmltopdf
- Defined in:
- lib/riven/wkhtmltopdf.rb
Instance Method Summary collapse
Instance Method Details
#check_installation ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/riven/wkhtmltopdf.rb', line 4 public def check_installation `wkhtmltopdf -V > /dev/null 2>&1` unless $?.exitstatus == 0 puts "Seems like wkhtmltopdf is not correctly installed or set up" exit end end |
#generate_pdf(html_file, output_file) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/riven/wkhtmltopdf.rb', line 13 public def generate_pdf(html_file, output_file) params = [ '--disable-smart-shrinking', '--page-size A4', '--margin-bottom 10mm', '--margin-top 10mm', '--margin-left 8mm', '--margin-right 8mm' ] output = `wkhtmltopdf #{params.join(' ')} #{html_file.file_name} #{output_file} 2>&1` end |