From 24208a654fe65a2016244f0ebb99af66ed0bd8d7 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 18 Feb 2013 12:13:30 +0100 Subject: received fax documents --- app/models/fax_document.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/models') diff --git a/app/models/fax_document.rb b/app/models/fax_document.rb index 564d3bb..a0d2100 100644 --- a/app/models/fax_document.rb +++ b/app/models/fax_document.rb @@ -68,6 +68,29 @@ class FaxDocument < ActiveRecord::Base FileUtils.rm_rf tmp_dir end + def tiff_to_pdf() + tiff_file = self.tiff.to_s.gsub(self.tiff.store_path, '') + if !File.exists?(tiff_file) + return nil + end + + working_path, file_name = File.split(tiff_file) + pdf_file = "#{working_path}/#{File.basename(tiff_file, '.tiff')}.pdf" + + system "tiff2pdf \\ + -o \"#{pdf_file}\" \\ + -p letter \\ + -a \"#{self.remote_station_id}\" \\ + -c \"AMOOMA Gemeinschaft version #{GsParameter.get('GEMEINSCHAFT_VERSION')}\" \\ + -t \"#{self.remote_station_id}\" \"#{tiff_file}\"" + + if !File.exists?(pdf_file) + return nil + end + + return pdf_file, tiff_file + end + private def convert_pdf_to_tiff page_size_a4 = '595 842' -- cgit v1.2.3