Add Watermark to First Page of PDF

I’m trying to create a script that, whenever a message is received by Mail 2 (OS X 10.4) with a PDF attached (addressed to a specific address and sent from a certain domain), takes that attached PDF document, applies a PDF watermark to just the first page, saves it with a new name “File Name (Revised).pdf”, and e-mails it back to the person who originally sent it.

What I can’t seem to figure out is: (a) how to use a PDF (or an EPS file if that’s supported) as a watermark, and (b) how to apply a watermark to just the first page, not every page in the document.

I have Adobe Acrobat Professional if this would make the process simpler, but I’d prefer to use OS X’s built-in editing capabilities.

Any suggestions would be greatly appreciated!

I don’t know if there’s a way to do it with Acrobat. I’ve only used it for distilling. I know there are lots of plugins for fancy acrobat watermarking, but I don’t know if many are Mac. Try googling.

I had good luck using with do shell script for combining PDFs. Give it a try and see if it works for you.

There’s an automator command to add watermark to PDFs but I’m not sure how you can fit it in the workflow. Checking for the attachment from some specific domain/to specific address can be done using a Mail rule but I don’t know how you can download the attachment.

I think I’ve figured out the Mail rules (that seems to be the easy part).

I’ve tried the Automator watermark command, but the problem is that it affects all pages of the PDF and doesn’t appear to be customizable for just the first page. Perhaps the workaround would be to take the first page of the document, make it into a separate document, add the watermark, and then combine them back together?

It also appears to only support JPEGs for the watermark which is not what I want to do: I really need to use a high-resolution file (PDF or EPS) for printing purposes since the watermark includes both text and vector graphics. (This is why I mentioned that I do have Adobe Acrobat Pro in case the native OS X watermarks are really limited to JPEG files. I’d still prefer to use the built-in capabilities, though.)

Thank you, digest4d, for the tip about Pdftk. I’ll check it out.