Sha256: d95c22c6d40b7cae3aa8d56c2cdf689f3744528e93619f1189bf36fe8b3a0868
Contents?: true
Size: 1.61 KB
Versions: 11
Compression:
Stored size: 1.61 KB
Contents
require 'nailgun' module ActsAsFlyingSaucer # Xhtml2Pdf # class Xhtml2Pdf def self.write_pdf(options) if !File.exists?(options[:input_file]) File.open(options[:input_file], 'w') do |file| file << options[:html] end end java_dir = File.join(File.expand_path(File.dirname(__FILE__)), "java") class_path = "'.#{options[:classpath_separator]}#{java_dir}/jar/acts_as_flying_saucer.jar'" if options[:nailgun] command = "#{Nailgun::NgCommand::NGPATH} --nailgun-server #{ActsAsFlyingSaucer::Config.options[:nailgun_host]} --nailgun-port #{ ActsAsFlyingSaucer::Config.options[:nailgun_port]} Xhtml2Pdf #{options[:input_file]} #{options[:output_file]}" else command = "#{options[:java_bin]} -Xmx512m -Djava.awt.headless=true -cp #{class_path} acts_as_flying_saucer.Xhtml2Pdf #{options[:input_file]} #{options[:output_file]}" end system(command) end def self.encrypt_pdf(options,output_file_name,password) java_dir = File.join(File.expand_path(File.dirname(__FILE__)), "java") class_path = "'.#{options[:classpath_separator]}#{java_dir}/jar/acts_as_flying_saucer.jar'" if options[:nailgun] command = "#{Nailgun::NgCommand::NGPATH} --nailgun-server #{ActsAsFlyingSaucer::Config.options[:nailgun_host]} --nailgun-port #{ ActsAsFlyingSaucer::Config.options[:nailgun_port]} encryptPdf #{options[:input_file]} #{options[:output_file]}" else command = "#{options[:java_bin]} -Xmx#{options[:max_memory_mb]}m -Djava.awt.headless=true -cp #{class_path} acts_as_flying_saucer.encryptPdf #{options[:output_file]} #{output_file_name} #{password}" end system(command) end end end
Version data entries
11 entries across 11 versions & 1 rubygems