Module: OVNI
- Defined in:
- lib/ovni.rb,
lib/ovni/config.rb,
lib/ovni/version.rb
Defined Under Namespace
Classes: Config
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.html_to_pdf(html, pdf_file, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ovni.rb', line 9 def self.html_to_pdf(html, pdf_file, = {}) = Config..merge() class_path = [File.join(File.(File.dirname(__FILE__)), "ovni/Xhtml2Pdf"), [:class_path]].join([:classpath_separator]) Tempfile.open("ovni") do |file| file << html file.flush command = "#{[:java_bin]} -Xmx#{[:max_memory_mb]}m -Djava.awt.headless=true -cp #{class_path} Xhtml2Pdf #{file.path} #{File.(pdf_file)}" system(command) return $? == 0 end end |