def stamp_pages(stamp, options = {})
      case stamp
      when String
        options[:location] ||= [:center]
        number_pages({ number_format: stamp }.merge(options))
      when Page_Methods
        # stamp = stamp.copy(true)
        if options[:underlay]
          (options[:page_range] ? pages[options[:page_range]] : pages).each { |p| p >> stamp }
        else
          (options[:page_range] ? pages[options[:page_range]] : pages).each { |p| p << stamp }
        end
      else
        raise TypeError, 'expecting a String or a PDF page as the stamp.'
      end
    end
def stamp_pages(stamp, options = {})
      case stamp
      when String
        options[:location] ||= [:center]
        number_pages({ number_format: stamp }.merge(options))
      when Page_Methods
        # stamp = stamp.copy(true)
        if options[:underlay]
          (options[:page_range] ? pages[options[:page_range]] : pages).each { |p| p >> stamp }
        else
          (options[:page_range] ? pages[options[:page_range]] : pages).each { |p| p << stamp }
        end
      else
        raise TypeError, 'expecting a String or a PDF page as the stamp.'
      end
    end
This method stamps all (or some) of the pages is the PDF with the requested stamp.

 The method accept:
 stamp:: either a String or a PDF page. If this is a String, you can add formating to add page numbering (i.e. "page number %i"). otherwise remember to escape any percent ('%') sign (i.e. "page \%number not shown\%").
 options:: an options Hash.

 If the stamp is a PDF page, only :page_range and :underlay (to reverse-stamp) are valid options.

 If the stamp is a String, than all the options used by {#number_pages} or {Page_Methods#textbox} can be used.

 The default :location option is :center = meaning the stamp will be stamped all across the page unless the :x, :y, :width or :height options are specified.