Sha256: 882113c3633094838f28607fdf6ece626c798dba954f35aa664034c5b411e9b4

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8
#
# We normally write our documents from top to bottom and it is no different with
# Prawn. Even if the origin is on the bottom left corner we still fill the page
# from the top to the bottom. In other words the cursor for inserting content
# starts on the top of the page.
#
# Most of the functions that insert content on the page will start at the
# current cursor position and proceed to the bottom of the page.
#
# The following snippet shows how the cursor behaves when we add some text to
# the page and demonstrates some of the helpers to manage the cursor position.
# The <code>cursor</code> method returns the current cursor position.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  stroke_axis

  text "the cursor is here: #{cursor}"
  text "now it is here: #{cursor}"

  move_down 200
  text "on the first move the cursor went down to: #{cursor}"

  move_up 100
  text "on the second move the cursor went up to: #{cursor}"

  move_cursor_to 50
  text "on the last move the cursor went directly to: #{cursor}"
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
prawn-2.1.0 manual/basic_concepts/cursor.rb
prawn-git-2.0.1 manual/basic_concepts/cursor.rb
prawn-2.0.2 manual/basic_concepts/cursor.rb
prawn-2.0.1 manual/basic_concepts/cursor.rb
prawn-2.0.0 manual/basic_concepts/cursor.rb
prawn-1.3.0 manual/basic_concepts/cursor.rb
prawn-1.2.1 manual/basic_concepts/cursor.rb
prawn-1.1.0 manual/basic_concepts/cursor.rb