Sha256: 39ac0adf3453fb90f7999115c681479a8ef14d5d965a4008fa920773aae8d454
Contents?: true
Size: 1.03 KB
Versions: 7
Compression:
Stored size: 1.03 KB
Contents
require 'open3' require 'mn2pdf/version' module Mn2pdf MN2PDF_JAR_PATH = File.join(File.dirname(__FILE__), '../bin/mn2pdf.jar') def self.help cmd = ['java', '-jar', MN2PDF_JAR_PATH].join(' ') message, error_str, status = Open3.capture3(cmd) message end def self.version cmd = ['java', '-jar', MN2PDF_JAR_PATH, '-v'].join(' ') message, error_str, status = Open3.capture3(cmd) message.strip end def self.convert(url_path, output_path, xsl_stylesheet, options = "") return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil? puts MN2PDF_JAR_PATH cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', MN2PDF_JAR_PATH, '--xml-file', url_path, '--xsl-file', xsl_stylesheet, '--pdf-file', output_path, options].join(' ') puts cmd stdout_str, error_str, status = Open3.capture3(cmd) unless status.success? # Strip default mn2pdf message stdout_str = stdout_str.gsub('Preparing...', '').strip raise [stdout_str, error_str].join(' ').strip end end end
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
mn2pdf-1.28 | lib/mn2pdf.rb |
mn2pdf-1.27 | lib/mn2pdf.rb |
mn2pdf-1.26 | lib/mn2pdf.rb |
mn2pdf-1.25 | lib/mn2pdf.rb |
mn2pdf-1.24 | lib/mn2pdf.rb |
mn2pdf-1.23 | lib/mn2pdf.rb |
mn2pdf-1.22.2 | lib/mn2pdf.rb |