summaryrefslogtreecommitdiff
path: root/app/models/fax_document.rb
diff options
context:
space:
mode:
authorJulian Pawlowski <julian.pawlowski@gmail.com>2013-02-18 13:14:48 +0100
committerJulian Pawlowski <julian.pawlowski@gmail.com>2013-02-18 13:14:48 +0100
commitac61082ea770d88e2ab7d9459771c25bfc73c13a (patch)
tree3f63e9e4f351734e3c8f1323ca40a750a9658b5d /app/models/fax_document.rb
parent251e15fc292deed58d1d2b4fec2ce1172c2d8f75 (diff)
parent24208a654fe65a2016244f0ebb99af66ed0bd8d7 (diff)
Merge branch 'develop' of https://github.com/amooma/GS5 into develop
Diffstat (limited to 'app/models/fax_document.rb')
-rw-r--r--app/models/fax_document.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/models/fax_document.rb b/app/models/fax_document.rb
index 2e37998..c73fa3d 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'