# File lib/pdf/writer.rb, line 2084
2084:   def new_page(insert = false, page = nil, pos = :after)
2085:     reset_state_at_page_finish
2086: 
2087:     if insert
2088:         # The id from the PDF::Writer class is the id of the contents of the
2089:         # page, not the page object itself. Query that object to find the
2090:         # parent.
2091:       _new_page = PDF::Writer::Object::Page.new(self, { :rpage => page, :pos => pos })
2092:     else
2093:       _new_page = PDF::Writer::Object::Page.new(self)
2094:     end
2095: 
2096:     reset_state_at_page_start
2097: 
2098:       # If there has been a stroke or fill color set, transfer them.
2099:     fill_color!
2100:     stroke_color!
2101:     stroke_style!
2102: 
2103:       # the call to the page object set @current_contents to the present page,
2104:       # so this can be returned as the page id
2105: #   @current_contents
2106:     _new_page
2107:   end