views:

475

answers:

2

Im using prawn to generate a PDF output in a rails app. How do i change the color of the outputted text?

+6  A: 

Have you tried fill_color?

require "rubygems"
require "prawn" 

Prawn::Document.generate "hello.pdf" do 
  fill_color "0000ff" 
  text "Hello World (in blue)", :at => [200,720], :size => 32 
end
The MYYN
A: 

Note that you can also set a CMYK color (in this example 100% key black):

fill_color(0,0,0,100)
gawin