ruby-on-railsrubyrubygemsprawn

Set the font color in prawn


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


Solution

  • 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