Set the font color in prawn

Arcath picture Arcath · Jan 7, 2010 · Viewed 13.7k times · Source

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

Answer

miku picture miku · Jan 7, 2010

Have you tried fill_color? Code below should work:

require "rubygems"
require "prawn" 

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