Im using prawn to generate a PDF output in a rails app. How do i change the color of the outputted text?
if you use any 1.x version (it's only a pre-release as of writing) you can also use:
Gem install:
$ gem install prawn --pre
Code:
require "rubygems"
require "prawn"
Prawn::Document.generate "hello.pdf" do
text "Hello World (in blue)", :color => "0000ff", :size => 32
end
Have you tried fill_color
? Code below should work:
require "rubygems"
require "prawn"
Prawn::Document.generate "hello.pdf" do
fill_color "0000ff"
text_box "Hello World (in blue)", :at => [200,720], :size => 32
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With