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.18 lib/libis/format/pdf_merge.rb
libis-format-0.9.17 lib/libis/format/pdf_merge.rb
libis-format-0.9.16 lib/libis/format/pdf_merge.rb
libis-format-0.9.15 lib/libis/format/pdf_merge.rb
libis-format-0.9.13 lib/libis/format/pdf_merge.rb
libis-format-0.9.12 lib/libis/format/pdf_merge.rb
libis-format-0.9.11 lib/libis/format/pdf_merge.rb
libis-format-0.9.10 lib/libis/format/pdf_merge.rb
libis-format-0.9.8 lib/libis/format/pdf_merge.rb
libis-format-0.9.7 lib/libis/format/pdf_merge.rb
libis-format-0.9.6 lib/libis/format/pdf_merge.rb
libis-format-0.9.5-java lib/libis/format/pdf_merge.rb
libis-format-0.9.4 lib/libis/format/pdf_merge.rb