# File lib/pdf/writer.rb, line 2147
2147:   def new_page(insert = false, page = nil, pos = :after)
2148:     reset_state_at_page_finish
2149: 
2150:     if insert
2151:         # The id from the PDF::Writer class is the id of the contents of the
2152:         # page, not the page object itself. Query that object to find the
2153:         # parent.
2154:       _new_page = PDF::Writer::Object::Page.new(self, { :rpage => page, :pos => pos })
2155:     else
2156:       _new_page = PDF::Writer::Object::Page.new(self)
2157:     end
2158: 
2159:     reset_state_at_page_start
2160: 
2161:       # If there has been a stroke or fill color set, transfer them.
2162:     fill_color!
2163:     stroke_color!
2164:     stroke_style!
2165: 
2166:       # the call to the page object set @current_contents to the present page,
2167:       # so this can be returned as the page id
2168: #   @current_contents
2169:     _new_page
2170:   end