Sha256: f6dbc6f9743dbfc3d0fdd8ccf4088b4ce2a3494b39016683d99151aee705790c

Contents?: true

Size: 812 Bytes

Versions: 10

Compression:

Stored size: 812 Bytes

Contents

require 'nokogiri'

require_relative 'base'

require 'libis/format/tool/fop_pdf'

module Libis
  module Format
    module Converter

      class FopPdfConverter < Libis::Format::Converter::Base

        def self.input_types
          [:XML]
        end

        def self.output_types(format = nil)
          return [] unless input_types.include?(format) if format
          [:PDF]
        end

        def convert(source, target, _format, opts = {})
          super

          unless File.file?(source) && File.exist?(source) && File.readable?(source)
            error "File '#{source}' does not exist or is not readable"
            return nil
          end

          FileUtils.mkpath(File.dirname(target))

          Libis::Format::Tool::FopPdf.run(source, target)

        end

      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
libis-format-1.2.9 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.8 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.7 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.6 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.5 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.3 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.2 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.1 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.2.0 lib/libis/format/converter/fop_pdf_converter.rb
libis-format-1.1.0 lib/libis/format/converter/fop_pdf_converter.rb