def initialize(options={},&block)
Prawn.verify_options [:page_size, :page_layout, :left_margin,
:right_margin, :top_margin, :bottom_margin, :skip_page_creation,
:compress, :skip_encoding, :text_options, :background ], options
@objects = []
@info = ref(:Creator => "Prawn", :Producer => "Prawn")
@pages = ref(:Type => :Pages, :Count => 0, :Kids => [])
@root = ref(:Type => :Catalog, :Pages => @pages)
@page_size = options[:page_size] || "LETTER"
@page_layout = options[:page_layout] || :portrait
@compress = options[:compress] || false
@skip_encoding = options[:skip_encoding]
@background = options[:background]
@font_size = 12
text_options.update(options[:text_options] || {})
@margins = { :left => options[:left_margin] || 36,
:right => options[:right_margin] || 36,
:top => options[:top_margin] || 36,
:bottom => options[:bottom_margin] || 36 }
generate_margin_box
@bounding_box = @margin_box
start_new_page unless options[:skip_page_creation]
if block
block.arity < 1 ? instance_eval(&block) : block[self]
end
end