# File lib/prawn/stamp.rb, line 45
    def create_stamp(user_defined_name="", &block)
      raise Prawn::Errors::InvalidName if user_defined_name.empty?

      if stamp_dictionary_registry[user_defined_name]
        raise Prawn::Errors::NameTaken
      end

      # BBox origin is the lower left margin of the page, so we need
      # it to be the full dimension of the page, or else things that
      # should appear near the top or right margin are invisible
      stamp_dictionary = ref!(:Type    => :XObject,
                              :Subtype => :Form,
                              :BBox => [0, 0, page_dimensions[2], page_dimensions[3]])

      stamp_dictionary_name = "Stamp#{next_stamp_dictionary_id}"

      stamp_dictionary_registry[user_defined_name] = 
        { :stamp_dictionary_name => stamp_dictionary_name, 
          :stamp_dictionary      => stamp_dictionary}

      
      @active_stamp_stream = ""
      @active_stamp_dictionary = stamp_dictionary

      yield if block_given?

      stamp_dictionary.data[:Length] = @active_stamp_stream.length + 1
      stamp_dictionary << @active_stamp_stream

      @active_stamp_stream = nil
      @active_stamp_dictionary = nil
    end