Sha256: e7008ca2dfb7a5282ffd4a729f1a83a956ede70d31cab801808b004cf8432a57
Contents?: true
Size: 982 Bytes
Versions: 2
Compression:
Stored size: 982 Bytes
Contents
# encoding: utf-8 # # Demonstrates extending Text::Box # require File.expand_path(File.join(File.dirname(__FILE__), %w[.. example_helper])) Prawn::Document.generate "shaped_text_box.pdf" do |pdf| module ShapedBox def available_width height + 25 end end Prawn::Text::Box.extensions << ShapedBox pdf.stroke_rectangle([10, pdf.bounds.top - 10], 300, 300) pdf.text_box("A" * 500, :at => [10, pdf.bounds.top - 10], :width => 300, :height => 300, :align => :center) Prawn::Text::Formatted::Box.extensions << ShapedBox pdf.stroke_rectangle([10, pdf.bounds.top - 330], 300, 300) pdf.formatted_text_box([:text => "A" * 500, :color => "009900"], :at => [10, pdf.bounds.top - 330], :width => 300, :height => 300, :align => :center) end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
prawn-0.11.1 | examples/text/shaped_text_box.rb |
davebenvenuti-prawn-0.11.1.pre | examples/text/shaped_text_box.rb |