diff options
author | spag <spag@golwen.net> | 2013-02-18 12:13:30 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-02-18 12:13:30 +0100 |
commit | 24208a654fe65a2016244f0ebb99af66ed0bd8d7 (patch) | |
tree | 46072a6ed862326ebcf610ea1cfbd9e4145b33ed /app/models/fax_document.rb | |
parent | 45855989c9f1b9122d57f3328102730b49236432 (diff) |
received fax documents
Diffstat (limited to 'app/models/fax_document.rb')
-rw-r--r-- | app/models/fax_document.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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' |