Sha256: ae34272e0aab6f5918d808136f70885c8f2e77a9c47857fa386a8d6d6493493d

Contents?: true

Size: 1.31 KB

Versions: 20

Compression:

Stored size: 1.31 KB

Contents

# encoding: utf-8
#
# This demonstrates the Prawn options for document and page margin, similar to CSS shorthand.
#
require "#{File.dirname(__FILE__)}/../example_helper.rb"

LOREM = ("Lorem ipsum dolor sit amet, consectetur adipisicing elit, "+
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "+
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris "+
"nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in "+
"reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla "+
"pariatur. Excepteur sint occaecat cupidatat non proident, sunt in " +
"culpa qui officia deserunt mollit anim id est laborum. ") * 20

Prawn::Document.generate("margin.pdf", :margin => 100) do |pdf|

  pdf.text "100 on all sides", :style => :bold
  pdf.text LOREM
  
  pdf.start_new_page(:margin => 100, :left_margin => 0)
  pdf.text "100 on all sides but 0 on the left", :style => :bold
  pdf.text LOREM

  pdf.start_new_page(:margin => [100, 0])
  pdf.text "100 top and bottom, 0 left and right.", :style => :bold
  pdf.text LOREM
  
  pdf.start_new_page(:margin => [100, 0, 50])
  pdf.text "100 top, 0 left and right, 50 bottom.", :style => :bold
  pdf.text LOREM
  
  pdf.start_new_page(:margin => [0, 50, 100, 150])
  pdf.text "0 top, 50 right, 100 bottom, 150 left.", :style => :bold
  pdf.text LOREM

end

Version data entries

20 entries across 20 versions & 7 rubygems

Version Path
piglop-prawn-0.10.2.3 examples/general/margin.rb
piglop-prawn-0.10.2.2 examples/general/margin.rb
piglop-prawn-0.10.2.1 examples/general/margin.rb
prawn-0.11.1.pre examples/general/margin.rb
goodwill-prawn-edge-0.10.0 examples/general/margin.rb
alphasights-prawn-0.10.4 examples/general/margin.rb
alphasights-prawn-0.10.3 examples/general/margin.rb
alphasights-prawn-0.10.2 examples/general/margin.rb
alphasights-prawn-0.10.1 examples/general/margin.rb
alphasights-prawn-0.10.0 examples/general/margin.rb
prawn-core-0.8.4 examples/general/margin.rb
prawn-graph-0.0.2 vendor/prawn-core/examples/general/margin.rb
prawn-graph-0.0.1 vendor/prawn-core/examples/general/margin.rb
prawn-core-0.7.2 examples/general/margin.rb
prawn-core-0.7.1 examples/general/margin.rb
prawn-layout-0.3.2 vendor/prawn-core/examples/general/margin.rb
prawn-core-0.6.3 examples/general/margin.rb
prawn-core-0.6.2 examples/general/margin.rb
prawn-layout-0.3.1 vendor/prawn-core/examples/general/margin.rb
prawn-core-0.6.1 examples/general/margin.rb