Created
December 2, 2011 18:01
-
-
Save giuseb/1424200 to your computer and use it in GitHub Desktop.
Example of multiple indents across columns with Prawn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'prawn', 'lib')) | |
require 'rubygems' | |
require 'prawn' | |
require 'prawn/security' | |
require "prawn/layout" | |
Prawn.debug = true | |
Prawn::Document.generate "column_indent_bug.pdf" do | |
column_box([0, cursor], width: 500, height: 700, columns: 3, spacer: 25) do | |
font_size 10 | |
3.times do | |
stroke_bounds | |
text "No indent", style: :bold | |
text "left_side #{bounds.left_side}", style: :italic | |
text "left #{bounds.left}; right #{bounds.right}", style: :italic | |
text "width #{bounds.width}", style: :italic | |
text "Loremipsumdolorsitamet,consecteturadipisicingelit,seddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat." | |
indent(20,10) do | |
text "Indent 20, 10", style: :bold | |
text "left_side #{bounds.left_side}", style: :italic | |
text "left #{bounds.left}; right #{bounds.right}", style: :italic | |
text "width #{bounds.width}", style: :italic | |
text "Loremipsumdolorsitamet,consecteturadipisicingelit,seddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat." | |
indent(10, -10) do | |
text "Indent 10, -10", style: :bold | |
text "left #{bounds.left}; right #{bounds.right}", style: :italic | |
text "width #{bounds.width}", style: :italic | |
text "Loremipsumdolorsitamet,consecteturadipisicingelit,seddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat." | |
end | |
text "done indenting" | |
end | |
text "done indenting" | |
bounds.move_past_bottom | |
end | |
end | |
end | |
system "open column_indent_bug.pdf" | |
puts "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment