Sha256: 53924434bacc5f68205473c953a38a33120ae138e77ecd07118a891675eba749

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

# encoding: utf-8
#
# Example of two ways of indenting paragraphs
#
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

Prawn::Document.generate "indent_paragraphs.pdf" do |pdf|
  hello = "hello " * 50
  world = "world " * 50
  string = hello + "©\n" + world + "©"
  pdf.text(string, :indent_paragraphs => 60, :align => :justify)

  pdf.move_cursor_to(pdf.font.height)
  pdf.text(string, :indent_paragraphs => 60, :align => :justify)

  pdf.move_cursor_to(pdf.font.height * 3)
  pdf.text(string, :indent_paragraphs => 60, :align => :justify)

  # can also indent using a non-breaking space
  nbsp = Prawn::Text::NBSP
  pdf.text("\n\n\n\n#{nbsp * 10}" + hello + "\n#{nbsp * 10}" + world, :align => :justify)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-0.12.0 examples/text/indent_paragraphs.rb
prawn-0.11.1 examples/text/indent_paragraphs.rb