This may be what you want,prawn https://github.com/prawnpdf/prawn
require "prawn"
Prawn::Document.generate("hello.pdf") do
text "Hello World!"
end
you put your template in your app, then use this gem to fill out it.
About the pie chart,prawn-graph may help. https://github.com/HHRy/prawn-graph/, it is a extension of for prawn in chart. The code may like:
require 'rubygems'
require 'prawn/core'
require 'prawn/graph'
data = [ ['A', 10], ['B', 11], ['C' 12] ]
Prawn::Document.generate('test.pdf') do
test 'Graph Example'
bar_graph data at => [10,10]
end