    # File lib/prawn/document.rb, line 180
        def initialize(options={},&block)
           Prawn.verify_options [:page_size, :page_layout, :margin, :left_margin,
             :right_margin, :top_margin, :bottom_margin, :skip_page_creation,
             :compress, :skip_encoding, :text_options, :background, :info,
             :optimize_objects], options

           # need to fix, as the refactoring breaks this
           # raise NotImplementedError if options[:skip_page_creation]

           self.class.extensions.reverse_each { |e| extend e }

           options[:info] ||= {}
           options[:info][:Creator] ||= "Prawn"
           options[:info][:Producer] = "Prawn"

           options[:info].keys.each do |key|
             if options[:info][key].kind_of?(String)
               options[:info][key] = Prawn::LiteralString.new(options[:info][key])
             end
           end

           @version = 1.3
           @store = Prawn::Core::ObjectStore.new(options[:info])
           @trailer = {}

           @before_render_callbacks = []
           @on_page_create_callback = nil

           @compress         = options[:compress] || false
           @optimize_objects = options.fetch(:optimize_objects, false)
           @skip_encoding    = options[:skip_encoding]
           @background       = options[:background]
           @font_size        = 12

           @pages            = []
           @page             = nil

           @bounding_box  = nil
           @margin_box    = nil

           @text_options = options[:text_options] || {}
           @default_line_wrap = Prawn::Text::LineWrap.new

           @page_number = 0

           options[:size] = options.delete(:page_size)
           options[:layout] = options.delete(:page_layout)

           if options[:skip_page_creation]
             start_new_page(options.merge(:orphan => true))
           else
             start_new_page(options)
           end

           @bounding_box = @margin_box

           if block
             block.arity < 1 ? instance_eval(&block) : block[self]
           end
         end