Similar in approach (and based on) perl's PostScript::Simple.
Sample usage, importing and scaling an eps, drawing a line, adding text, and converting to pdf (from a program that uses pdftops in order to be able to arbitrarily draw on pdf pages).
ps = PostScript.new :orient => :portrait
scale = [(ps.h - 25.0) / x1, ps.w * 1.0 / x2, 1].min
ps.importepsfile epsfn, (ps.w - x2 * scale) / 2, ((ps.h - 25) - x1 * scale) / 2 + 25, :scale => scale
ps.line 0, 25, ps.w, 25
ps.setfont 'Helvetica-Bold', 12
ps.text id, ps.w - 8,8, :align => :right
These details are provided for information only. No information here is legal advice and should not be used as such.