Sha256: 1084bd8498857c915f7d75ad1ab90616e387d7c3e43ee71dadcb952ce8a2c1fd

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

module Clamsy
  class CupsPdfPrinter < BasePrinter
    class << self

      private

        def doc_to_pdf(doc_path)
          system("#{config.ooffice_cmd} #{doc_path}")
          pdf_path = tmp_pdf_path(doc_path)
          file_must_exist!(pdf_path, 10) ; pdf_path
        end

        def tmp_pdf_path(doc_path)
          if output_file = config.cups_output_file
            output_file.is_a?(Proc) ? output_file.call : output_file
          else
            # NOTE: we don't attempt to trim away the extension cos it is a hard
            # fact that internally we are always working with paths derived from
            # Tempfile instances, thus, no need for extension replacing.
            File.join(config.cups_output_dir, File.basename(doc_path)) + '.pdf'
          end
        end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clamsy-0.0.4 lib/clamsy/cups_pdf_printer.rb