Using the open source PDF::Writer library for Ruby to create PDF documents on the fly and save them on the server.
require "rubygems"
# Get PDF::Writer from http://ruby-pdf.rubyforge.org/pdf-writer/
require "pdf/writer"
pdf = PDF::Writer.new
pdf.select_font "Times-Roman"
pdf.text "Hello World, Hello, Ruby, Hello PDF.", :font_size => 52, :justification => :center
pdf.save_as("HelloWorld.pdf")