Sha256: 0e336a2fd26c4b6f0b5e2998eb6f02baafe689d5423637166555f8b37fb1debd

Contents?: true

Size: 963 Bytes

Versions: 33

Compression:

Stored size: 963 Bytes

Contents

require 'os'

require 'libis/tools/extend/string'
require 'libis/tools/logger'
require 'libis/tools/command'

require 'libis/format/config'

module Libis
  module Format

    class PdfMerge
      include ::Libis::Tools::Logger

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

      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
    end

  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
libis-format-0.9.41 lib/libis/format/pdf_merge.rb
libis-format-0.9.40 lib/libis/format/pdf_merge.rb
libis-format-0.9.39 lib/libis/format/pdf_merge.rb
libis-format-0.9.38 lib/libis/format/pdf_merge.rb
libis-format-0.9.37 lib/libis/format/pdf_merge.rb
libis-format-0.9.36 lib/libis/format/pdf_merge.rb
libis-format-0.9.35 lib/libis/format/pdf_merge.rb
libis-format-0.9.33 lib/libis/format/pdf_merge.rb
libis-format-0.9.32 lib/libis/format/pdf_merge.rb
libis-format-0.9.30 lib/libis/format/pdf_merge.rb
libis-format-0.9.29 lib/libis/format/pdf_merge.rb
libis-format-0.9.28 lib/libis/format/pdf_merge.rb
libis-format-0.9.27 lib/libis/format/pdf_merge.rb
libis-format-0.9.25 lib/libis/format/pdf_merge.rb
libis-format-0.9.24 lib/libis/format/pdf_merge.rb
libis-format-0.9.23 lib/libis/format/pdf_merge.rb
libis-format-0.9.22 lib/libis/format/pdf_merge.rb
libis-format-0.9.21 lib/libis/format/pdf_merge.rb
libis-format-0.9.20 lib/libis/format/pdf_merge.rb
libis-format-0.9.19 lib/libis/format/pdf_merge.rb