Sha256: ad5c67ec167f52bc72aa1c630b0be9fc6b273f2e0f9325a6545295bd78060227

Contents?: true

Size: 470 Bytes

Versions: 9

Compression:

Stored size: 470 Bytes

Contents

module RailsConnector
  module Fop
    #
    # Is raised if the PDF generation fails.
    # The error message contains the Java error stack trace of the Apache FOP.
    #
    class GenerationFailed < RuntimeError; end

    CMD = 'fop -xml "%s" -xsl "%s" -pdf "%s" 2>&1'

    def self.generate_pdf(xml, xsl, pdf)
      output = `#{CMD % [xml, xsl, pdf]}`
      unless `file -pb "#{pdf}"`.include?('PDF')
        raise GenerationFailed, output
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
infopark_rails_connector-6.8.0.515.34928522 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.498.46559598 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.480.261594408 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.444.171626367 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.406.131718077 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.356.19698103 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.348.160665197 lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.328.4a753fc lib/rails_connector/fop.rb
infopark_rails_connector-6.8.0.322.c003f11 lib/rails_connector/fop.rb