Class: Metanorma::Output::XslfoPdf

Inherits:
Base
  • Object
show all
Defined in:
lib/metanorma/output/xslfo.rb

Instance Method Summary collapse

Instance Method Details

#convert(url_path, output_path, xsl_stylesheet) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/metanorma/output/xslfo.rb', line 8

def convert(url_path, output_path, xsl_stylesheet)
  return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
  pdfjar = File.join(File.dirname(__FILE__), "../../../bin/mn2pdf.jar")
  cmd = ["java", "-jar", pdfjar, "--xml-file", url_path, "--xsl-file",
         xsl_stylesheet, "--pdf-file", output_path].join(" ")
  _, error_str, status = Open3.capture3(cmd)
  raise error_str unless status.success?
end