Top Level Namespace
Defined Under Namespace
Modules: PdfService
Instance Method Summary collapse
- #command ⇒ Object
- #convert(html) ⇒ Object
-
#rubygems ⇒ Object
Resources.
-
#wkhtmltopdf ⇒ Object
HELPERS.
Instance Method Details
#command ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pdf_service_server.rb', line 53 def command [ wkhtmltopdf, "--page-size letter", "--margin-right 0", "--margin-top 0", "--margin-bottom 0", "--disable-smart-shrinking", "--encoding UTF-8", "--margin-left 0", "--quiet", "-", "-" ] end |
#convert(html) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/pdf_service_server.rb', line 68 def convert html pdf = Kernel.open('|-', "w+") exec command.join(' ') if pdf.nil? pdf.puts html pdf.close_write result = pdf.gets nil pdf.close_read result end |
#rubygems ⇒ Object
Resources
2 |
# File 'lib/pdf_service_server.rb', line 2 require 'rubygems' |
#wkhtmltopdf ⇒ Object
HELPERS
44 45 46 47 48 49 50 51 |
# File 'lib/pdf_service_server.rb', line 44 def wkhtmltopdf executable = `which wkhtmltopdf`.chomp if '' == executable.to_s && RUBY_PLATFORM =~ /x86_64-linux/ executable = File.join File.dirname(__FILE__), '..', 'vendor', 'wkhtmltopdf-amd64-0.10.0_beta5-static-amd64' end executable end |