Sha256: 5abeb3bee028211707814a6245649f96f43280b5b849560304d65619ba8ca0ce

Contents?: true

Size: 868 Bytes

Versions: 3

Compression:

Stored size: 868 Bytes

Contents

module Bricks
  module Pdf
    module Engine
      module Prince
        CMD = Bricks::CONFIG['pdf']['cmd'] || 'prince'
        def command(opts)
          cmd = [CMD]
          {
            :http_user     => '--http-user=',
            :http_password => '--http-password=',
            :baseurl       => '--baseurl='
          }.each do |key, cmd_key|
            cmd << "#{cmd_key}#{opts[key]}"
          end

          # FIXME: find a way to redirect errors on screen instead of main log.
          cmd << "--log=#{Zena.log_path}"

          if file = opts[:input]
            cmd << file
          else
            cmd << "-"
          end

          if file = opts[:output]
            cmd << "-o #{file}"
          else
            cmd << "-o -"
          end

          cmd.join(' ')
        end
      end # Prince
    end # Engine
  end # Pdf
end # Bricks



Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zena-1.2.8 bricks/pdf/lib/bricks/pdf/engine/prince.rb
zena-1.2.7 bricks/pdf/lib/bricks/pdf/engine/prince.rb
zena-1.2.6 bricks/pdf/lib/bricks/pdf/engine/prince.rb