Class: Ilovepdf::Tool::Watermark

Inherits:
Ilovepdf::Task show all
Defined in:
lib/ilovepdf/tool/watermark.rb

Constant Summary collapse

API_PARAMS =
[
  :mode, :text, :image, :pages, :vertical_position, :horizontal_position,
  :vertical_position_adjustment, :horizontal_position_adjustment, :mosaic,
  :rotate, :font_family, :font_style, :font_size, :font_color, :transparency,
  :layer
]
VERTICAL_POSITION_VALUES =
['bottom', 'center' ,'top']
HORIZONTAL_POSITION_VALUES =
['left', 'middle', 'right']
FONT_FAMILY_VALUES =
['Arial', 'Arial Unicode MS', 'Verdana', 'Courier',
 'Times New Roman', 'Comic Sans MS', 'WenQuanYi Zen Hei',
 'Lohit Marathi'
]
LAYER_VALUES =
['above', 'below']

Constants inherited from Ilovepdf::Task

Ilovepdf::Task::DOWNLOAD_INFO

Constants included from Ilovepdf

VERSION

Instance Attribute Summary

Attributes inherited from Ilovepdf::Task

#ignore_errors, #ignore_password, #output_filename, #packaged_filename, #result, #task_id, #tool, #try_pdf_repair

Instance Method Summary collapse

Methods inherited from Ilovepdf::Task

#add_file, #add_file_from_url, #assign_meta_value, #blob, #delete!, #delete_file, #download, #download_info, #enable_file_encryption, #execute, #files, #status

Methods included from Ilovepdf

root

Constructor Details

#initialize(public_key, secret_key) ⇒ Watermark

Returns a new instance of Watermark.



22
23
24
25
# File 'lib/ilovepdf/tool/watermark.rb', line 22

def initialize(public_key, secret_key)
  self.tool = :watermark
  super(public_key, secret_key)
end

Instance Method Details

#font_family=(new_val) ⇒ Object



37
38
39
40
# File 'lib/ilovepdf/tool/watermark.rb', line 37

def font_family=(new_val)
  raise Errors::ArgumentEnumError.new(FONT_FAMILY_VALUES) unless FONT_FAMILY_VALUES.include? new_val
  @font_family = new_val
end

#horizontal_position=(new_val) ⇒ Object



32
33
34
35
# File 'lib/ilovepdf/tool/watermark.rb', line 32

def horizontal_position=(new_val)
  raise Errors::ArgumentEnumError.new(HORIZONTAL_POSITION_VALUES) unless HORIZONTAL_POSITION_VALUES.include? new_val
  @horizontal_position = new_val
end

#layer=(new_val) ⇒ Object



42
43
44
45
# File 'lib/ilovepdf/tool/watermark.rb', line 42

def layer=(new_val)
  raise Errors::ArgumentEnumError.new(LAYER_VALUES) unless LAYER_VALUES.include? new_val
  @layer = new_val
end

#vertical_position=(new_val) ⇒ Object



27
28
29
30
# File 'lib/ilovepdf/tool/watermark.rb', line 27

def vertical_position=(new_val)
  raise Errors::ArgumentEnumError.new(VERTICAL_POSITION_VALUES) unless VERTICAL_POSITION_VALUES.include? new_val
  @vertical_position = new_val
end