class HexaPDF::CLI::Watermark

Uses one or more pages of one PDF and underlays/overlays it/them onto another.

Private Instance Methods

page_index_generator(watermark) click to toggle source

Returns an Enumerator instance that returns the indices of the watermark pages that should be used.

# File lib/hexapdf/cli/watermark.rb, line 114
def page_index_generator(watermark)
  pages = parse_pages_specification(@pages, watermark.pages.count)
  Enumerator.new do |y|
    loop do
      pages.each {|index, _rotation| y << index }
      if @repeat == :last
        y << pages.last[0] while true
      end
    end
  end
end