# File lib/pdf/writer.rb, line 2034
2034:   def start_new_page(force = false)
2035:     page_required = true
2036: 
2037:     if @columns_on
2038:         # Check if this is just going to a new column. Increment the column
2039:         # number.
2040:       @columns[:current] += 1
2041: 
2042:       if @columns[:current] <= @columns[:size] and not force
2043:         page_required = false
2044:         @columns[:bot_y] = @y if @y < @columns[:bot_y]
2045:       else
2046:         @columns[:current] = 1
2047:         @top_margin = @columns[:top]
2048:         @columns[:bot_y] = absolute_top_margin
2049:       end
2050: 
2051:       w = @columns[:width]
2052:       g = @columns[:gutter]
2053:       n = @columns[:current] - 1
2054:       @left_margin = @columns[:left] + n * (g + w)
2055:       @right_margin = @page_width - (@left_margin + w)
2056:     end
2057: 
2058:     if page_required or force
2059:         # make a new page, setting the writing point back to the top.
2060:       @y = absolute_top_margin
2061:         # make the new page with a call to the basic class
2062:       if @insert_mode
2063:         id = new_page(true, @insert_page, @insert_position)
2064:         @pageset << id
2065:           # Manipulate the insert options so that inserted pages follow each
2066:           # other
2067:         @insert_page = id
2068:         @insert_position = :after
2069:       else
2070:         @pageset << new_page
2071:       end
2072: 
2073:     else
2074:       @y = absolute_top_margin
2075:     end
2076:     @pageset
2077:   end