2009-11-01から1ヶ月間の記事一覧

prawn:Prawn::Text#text_box :height

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text_box "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo", :height => 15 pdf.render_file(File.ba…

prawn:Prawn::Text#text_box :width

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text_box "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo", :width => 100 pdf.render_file(File.ba…

prawn:Prawn::Text#text_box :at

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text_box "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo", :at => [100, 100] pdf.render_file(Fil…

prawn:Prawn::Text#text_box :size

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text_box "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo", :size => 20 pdf.render_file(File.base…

prawn:Prawn::Text#text_box

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text_box "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo", {} pdf.render_file(File.basename($0, …

prawn:Prawn::Text#text_at

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo" pdf.text "foo foo foo foo foo foo foo foo …

prawn:Prawn::Text#text :wrap_block

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo" pdf.text "foo foo foo foo foo foo foo foo …

prawn:Prawn::Text#text :final_gap

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo" pdf.text "foo foo foo foo foo foo foo foo …

prawn:Prawn::Text#text :leading

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "no :leading" pdf.text ":leading => 10", :leading => 10 pdf.text ":leading => 20", :leading => 20 pdf.text ":leading => 30", :leading => 30 pdf.text "no :leading" pdf.r…

prawn:Prawn::Text#text :valign

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "Hello World", :valign => :top pdf.text "Hello World", :valign => :center pdf.text "Hello World", :valign => :bottom pdf.render_file(File.basename($0, ".rb") + ".pdf") …

prawn:Prawn::Text#text :rotate

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "Hello World", :at => [100,200], :rotate => 45 pdf.text "Hello World", :at => [100,300], :rotate => 90 pdf.render_file(File.basename($0, ".rb") + ".pdf")

prawn:Prawn::Text#text

まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.text "Hello World", :at => [100,100] pdf.text "Goodbye World", :at => [50,50], :size => 16 pdf.text "Will be wrapped when it hits the edge of your bounding box" pdf.t…

prawn:Prawn::Text#height_of

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new p pdf.height_of("abc") p pdf.height_of("foo") p pdf.height_of("A") p pdf.height_of("B") p pdf.height_of("Y") で、 13.872 13.872 13.872 13.872 13.872

prawn:Prawn::Stamp#stamp_at

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.create_stamp("my_stamp") { pdf.fill_circle_at([10, 15], :radius => 5) pdf.text("hello world", :at => [20, 10]) } pdf.stamp("my_stamp") pdf.stamp_at("my_stamp", [100, 100]) p…

prawn:Prawn::Stamp#create_stamp, #stamp

まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.create_stamp("my_stamp") { pdf.fill_circle_at([10, 15], :radius => 5) pdf.text("hello world", :at => [20, 10]) } pdf.stamp("my_stamp") pdf.start_new_page pdf.stamp("m…

prawn:measurement_extensions.rb

#!/usr/bin/env ruby require "prawn" require "prawn/measurement_extensions" p 1.mm p 1.cm p 1.dm p 1.m p 1.in p 1.yd p 1.ft p 1.pt で、 2.83464566929134 28.3464566929134 283.464566929134 2834.64566929134 72 2592 864 1

prawn:Prawn::Measurements#in2pt, #ft2pt, #yd2pt, #mm2pt, #cm2pt, #dm2pt, #m2pt, #pt2mm

#!/usr/bin/env ruby require "prawn" module Foo include Prawn::Measurements module_function :in2pt, :ft2pt, :yd2pt, :mm2pt, :cm2pt, :dm2pt, :m2pt, :pt2mm module_function :ft2in, :yd2in, :cm2mm, :dm2mm, :m2mm end p Foo.in2pt(1) p Foo.ft2pt(1…

prawn:Prawn::Measurements#ft2in, #yd2in

#!/usr/bin/env ruby require "prawn" module Foo include Prawn::Measurements module_function :ft2in, :yd2in end p Foo.ft2in(1) p Foo.yd2in(1) で、 12 36

prawn:Prawn::Measurements#cm2mm, #dm2mm, #m2mm

#!/usr/bin/env ruby require "prawn" module Foo include Prawn::Measurements module_function :cm2mm, :dm2mm, :m2mm end p Foo.cm2mm(1) p Foo.dm2mm(1) p Foo.m2mm(1) で、 10 100 1000

prawn:Prawn::Images#width, #height

#!/usr/bin/env ruby require "prawn" p Prawn::Document::JPG.new(File.binread("#{Prawn::BASEDIR}/data/images/pigs.jpg")).width p Prawn::Document::JPG.new(File.binread("#{Prawn::BASEDIR}/data/images/pigs.jpg")).height p Prawn::Document::PNG.n…

prawn:Prawn::Images::PNG#split_alpha_channel!

#!/usr/bin/env ruby require "prawn" x = Prawn::Document::PNG.new(File.binread("#{Prawn::BASEDIR}/data/images/dice.png")) #x.alpha_channel? x.split_alpha_channel! ?

prawn:Prawn::Images::PNG#pixel_bitlength

#!/usr/bin/env ruby require "prawn" p Prawn::Document::PNG.new(File.binread("#{Prawn::BASEDIR}/data/images/dice.png")).pixel_bitlength で、 32

prawn:Prawn::Images::PNG#colors

#!/usr/bin/env ruby require "prawn" p Prawn::Document::PNG.new(File.binread("#{Prawn::BASEDIR}/data/images/dice.png")).colors で、 3

prawn:Prawn::Images::PNG.new

#!/usr/bin/env ruby require "prawn" p Prawn::Document::PNG.new(File.binread("#{Prawn::BASEDIR}/data/images/dice.png")) で、 #

prawn:Prawn::Images::JPG.new

#!/usr/bin/env ruby require "prawn" p Prawn::Document::JPG.new(File.binread("#{Prawn::BASEDIR}/data/images/pigs.jpg")) で、 #<Prawn::Images::JPG:0xb7c69fc8 @width=604, @channels=3, @height=453, @bits=8></prawn::images::jpg:0xb7c69fc8>

prawn:Prawn::Images#image

まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pigs = "#{Prawn::BASEDIR}/data/images/pigs.jpg" pdf.image pigs, :at => [50,450], :width => 450 dice = "#{Prawn::BASEDIR}/data/images/dice.png" pdf.image dice, :at => [50,…

prawn:Prawn::Graphics::Transparency#transparent

まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new x, y = 100, 100 # both the fill and stroke will be at 50% opacity pdf.transparent(0.5) do pdf.text("hello world") pdf.fill_and_stroke_circle_at([x, y], :radius => 25) end…

prawn:Prawn::Graphics::JoinStyle#join_style, #join_style=

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.line_width = 20 p pdf.join_style y = 100 [:miter, :round, :bevel].each do |s| pdf.join_style(s) pdf.move_to(100, y) pdf.line_to(150, y) pdf.line_to(150, y-50) pdf.stroke y +…

prawn:Prawn::Graphics::JoinStyle::JOIN_STYLES

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new p Prawn::Document::JoinStyle::JOIN_STYLES p Prawn::Document::JOIN_STYLES で、 {:round=>1, :miter=>0, :bevel=>2} {:round=>1, :miter=>0, :bevel=>2}

prawn:Prawn::Graphics::Dash#undash

#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.line_width = 10 p pdf.dashed? pdf.dash(10, :space => 5, :phase => 0) p pdf.dashed? pdf.move_to(100, 150) pdf.line_to(150, 150) pdf.undash pdf.line_to(200, 150) pdf.stroke p …