You could also check out pdftk. It's a pretty powerful document processing tool.
pdflabs.com/docs/how-to-add-headers-footers-water…
EDIT:
pdftk and convert it to jpg or image format using convert command (available with the imagemagick package).Re: preview of the stamp on the PDF - I was seeking a web based solution, i.e. something that is shown in the browser so the use doesn't need to leave the web application.