lib/prawn/document.rb
# Creates and advances to a new page in the document.
#
# Page size, margins, and layout can also be set when generating a
# new page. These values will become the new defaults for page creation
#
#   pdf.start_new_page #=> Starts new page keeping current values
#   pdf.start_new_page(:size => "LEGAL", :layout => :landscape)
#   pdf.start_new_page(:left_margin => 50, :right_margin => 50)
#   pdf.start_new_page(:margin => 100)
#
# A template for a page can be specified by pointing to the path of and existing pdf.
# One can also specify which page of the template which defaults otherwise to 1.
#
#  pdf.start_new_page(:template => multipage_template.pdf, :template_page => 2)
#
# Note: templates get indexed by either the object_id of the filename or stream
# entered so that if you reuse the same template multiple times be sure to use the
# same instance for more efficient use of resources and smaller rendered pdfs.
Creates and advances to a new page in the document.
Page size, margins, and layout can also be set when generating a
new page. These values will become the new defaults for page creation



A template for a page can be specified by pointing to the path of and existing pdf.
One can also specify which page of the template which defaults otherwise to 1.



templates get indexed by either the object_id of the filename or stream
entered so that if you reuse the same template multiple times be sure to use the
same instance for more efficient use of resources and smaller rendered pdfs.
Creates and advances to a new page in the document . Page size margins and layout can also be set when generating a new page . These values will become the new defaults for page creation A template for a page can be specified by pointing to the path of and existing pdf . One can also specify which page of the template which defaults otherwise to 1 . templates get indexed by either the object_id of the filename or stream entered so that if you reuse the same template multiple times be sure to use the same instance for more efficient use of resources and smaller rendered pdfs .
def start_new_page(options = {})
      if last_page = state.page
        last_page_size    = last_page.size
        last_page_layout  = last_page.layout
        last_page_margins = last_page.margins
      end
      page_options = {:size => options[:size] || last_page_size,
                      :layout  => options[:layout] || last_page_layout,
                      :margins => last_page_margins}
      if last_page
        new_graphic_state = last_page.graphic_state.dup  if last_page.graphic_state
        new_graphic_state.color_space = {} if new_graphic_state
        page_options.merge!(:graphic_state => new_graphic_state)
      end
      merge_template_options(page_options, options) if options[:template]
      state.page = Prawn::Core::Page.new(self, page_options)
      apply_margin_options(options)
      generate_margin_box
      if last_page && (last_page.size != state.page.size ||
                       last_page.layout != state.page.layout)
        @bounding_box = @margin_box
      end
      state.page.new_content_stream if options[:template]
      use_graphic_settings(options[:template])
      forget_text_rendering_mode! if options[:template]
      unless options[:orphan]
        state.insert_page(state.page, @page_number)
        @page_number += 1
        canvas { image(@background, :scale => @background_scale, :at => bounds.top_left) } if @background
        @y = @bounding_box.absolute_top
        float do
          state.on_page_create_action(self)
        end
      end
    end
def start_new_page ( options = { } ) if last_page = state . page last_page_size = last_page . size last_page_layout = last_page . layout last_page_margins = last_page . margins end page_options = { :size => options [ :size ] || last_page_size , :layout => options [ :layout ] || last_page_layout , :margins => last_page_margins } if last_page new_graphic_state = last_page . graphic_state . dup if last_page . graphic_state new_graphic_state . color_space = { } if new_graphic_state page_options . merge! ( :graphic_state => new_graphic_state ) end merge_template_options ( page_options , options ) if options [ :template ] state . page = Prawn :: Core :: Page . new ( self , page_options ) apply_margin_options ( options ) generate_margin_box if last_page && ( last_page . size != state . page . size || last_page . layout != state . page . layout ) @bounding_box = @margin_box end state . page . new_content_stream if options [ :template ] use_graphic_settings ( options [ :template ] ) forget_text_rendering_mode! if options [ :template ] unless options [ :orphan ] state . insert_page ( state . page , @page_number ) @page_number += 1 canvas { image ( @background , :scale => @background_scale , :at => bounds . top_left ) } if @background @y = @bounding_box . absolute_top float do state . on_page_create_action ( self ) end end end
Creates and advances to a new page in the document.
Creates and advances to a new page in the document .
#erase the color space so that it gets reset on new page for fussy pdf-readers # Reset the bounding box if the new page has different size or layout
options
<not_specific>