Class: Libis::Format::PdfMerge

Inherits:
Object
  • Object
show all
Includes:
Tools::Logger
Defined in:
lib/libis/format/pdf_merge.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(source, target, options = []) ⇒ Object



15
16
17
# File 'lib/libis/format/pdf_merge.rb', line 15

def self.run(source, target, options = [])
  self.new.run source, target, options
end

Instance Method Details

#run(source, target, options = []) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/libis/format/pdf_merge.rb', line 19

def run(source, target, options = [])
  tool_dir = File.absolute_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'tools'))
  jar_file = File.join(tool_dir, 'PdfTool.jar')
  source = [source] unless source.is_a?(Array)

  if OS.java?
    # TODO: import library and execute in current VM. For now do exactly as in MRI.
  end

  Libis::Tools::Command.run(
      Libis::Format::Config[:java_path],
      '-cp', jar_file,
      'MergePdf',
      '--file_output', target,
      *options,
      *source,
  )

end