Class: StampIt::Background
- Inherits:
-
Object
- Object
- StampIt::Background
- Defined in:
- lib/stamp_it/background.rb
Class Method Summary collapse
- .add(original_path, watermark_path, output_path, password = nil) ⇒ Object
- .files_exist?(files) ⇒ Boolean
Class Method Details
.add(original_path, watermark_path, output_path, password = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/stamp_it/background.rb', line 5 def add(original_path, watermark_path, output_path, password = nil) unless files_exist?([original_path, watermark_path]) return 'Original or Watermark files are missing' end pdftk_cmd = StampIt.new.pdftk_cmd if password %x(#{pdftk_cmd} '#{original_path}' stamp '#{watermark_path}' output '#{output_path}' owner_pw '#{password}') else %x(#{pdftk_cmd} '#{original_path}' stamp '#{watermark_path}' output '#{output_path}') end $?.success? end |
.files_exist?(files) ⇒ Boolean
21 22 23 24 25 26 27 28 29 |
# File 'lib/stamp_it/background.rb', line 21 def files_exist?(files) success = true files.each do |f| success = false unless File.exist?(f) end success end |