Sha256: 83e5aefb19c459b7c66edaf19c35fddd22db1ded6ed61741a5dce2dae9cf3312

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 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
  pdf.text(hello + "\n" + world, :indent_paragraphs => 60)

  pdf.move_cursor_to(pdf.font.height)
  pdf.text(hello + "\n" + world, :indent_paragraphs => 60)

  pdf.move_cursor_to(pdf.font.height * 3)
  pdf.text(hello + "\n" + world, :indent_paragraphs => 60)

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
davebenvenuti-prawn-0.11.1.pre examples/text/indent_paragraphs.rb