class Prawn::Table

def initial_row_on_initial_page

Returns:
  • (Integer) - 0 (already at the top OR created a new page) or -1 (enough space)
def initial_row_on_initial_page
  # we're at the top of our bounds
  return 0 if fits_on_page?(@pdf.bounds.height)
  needed_height = row(0..number_of_header_rows).height
  # have we got enough room to fit the first row (including header row(s))
  use_reference_bounds = true
  return -1 if fits_on_page?(needed_height, use_reference_bounds)
  # If there isn't enough room left on the page to fit the first data row
  # (including the header), start the table on the next page.
  @pdf.bounds.move_past_bottom
  # we are at the top of a new page
  0
end