class Pdf4me::TextStamp

Attributes

file[RW]
pages[RW]
position_x[RW]
position_y[RW]
save_path[RW]
text[RW]

Public Instance Methods

call_api() click to toggle source
# File lib/pdf4me/actions/text_stamp.rb, line 44
def call_api
  client.multipart_post(
    path,
    file: File.open(file, 'rb'),
    alignX: position_x,
    alignY: position_y,
    text: text,
    pages: pages.join(',')
  ) do |request|
    download(request, save_path)
  end
end
pages=(value) click to toggle source
# File lib/pdf4me/actions/text_stamp.rb, line 29
def pages=(value)
  @pages = Array(value)
end
path() click to toggle source
# File lib/pdf4me/actions/text_stamp.rb, line 40
def path
  '/Stamp/TextStamp'
end

Private Instance Methods

page_attributes() click to toggle source
# File lib/pdf4me/actions/text_stamp.rb, line 59
def page_attributes
  if pages.empty?
    errors.add(:pages, 'must be valid numeric value')
  end

  unless pages.all? { |i| i.is_a?(Integer) }
    errors.add(:pages, 'contains values that are not numbers')
  end
end