# File lib/prawn/flexible-table.rb, line 122
  def initialize(data, document, options={})
    unless data.all? { |e| Array === e }
      raise Prawn::Errors::InvalidTableData,
        "data must be a two dimensional array of Prawn::Cells or strings"
    end

    @data     = data
    @document = document

    Prawn.verify_options [:font_size,:border_style, :border_width,
     :position, :headers, :row_colors, :align, :align_headers,
     :header_text_color, :border_color, :horizontal_padding,
     :vertical_padding, :padding, :column_widths, :width, :header_color ],
     options

    configuration.update(options)

    if padding = options[:padding]
      C(:horizontal_padding => padding, :vertical_padding => padding)
    end

    if options[:row_colors] == :pdf_writer
      C(:row_colors => ["ffffff","cccccc"])
    end

    if options[:row_colors]
      C(:original_row_colors => C(:row_colors))
    end

    # Once we have all configuration setted...
    normalize_data
    check_rows_lengths
    calculate_column_widths(options[:column_widths], options[:width])
  end