Stapler is a PDFtk (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) clone written in Ruby.