Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to add a small header to every page in a PDF on OS X? For example, some option in Preview or something? Maybe even something in AppleScript, etc?

I have a 200+ page PDF file and need to add a small name and account number at the top of every page, and it would be great to be able to do it in an automated way before (or during) printing.

share|improve this question
up vote 7 down vote accepted

If you're comfortable with command line, you could use pdftk to do the job.

Here are the steps:

1) Generate a pdf with your header where you want it (bkg.pdf);
2) Use the following command to add the file from 1) as a watermark;

pdftk inputfile.pdf background bkg.pdf output outputfile.pdf

You could generate the header file with e.g. LaTeX, or with Word or other word processing tool, even

Edit: Depending on what the contents of your PDF are (e.g. a scanned document), you may prefer a foreground "watermark" to cover the images; in that case, you should replace 'background' by 'stamp' in the above command.

Beware that you might need some iterations to make sure that you have things properly aligned.

Alternative option: use LaTeX to generate the header an include all pages, but it's a bit more involved.

share|improve this answer
Just needed to install pdftk and this worked perfectly. I wonder what else I can script up with this toolkit, it'll probably come in handy in my development work from time to time as well. Thanks! – David Feb 2 '12 at 15:19
@David: You're welcome. This toolkit is extremely powerful when using it inside a script. I use it daily for many tasks. Be sure to read the documentation. – Karolos Feb 2 '12 at 19:52
there's a typo in the actual command invocation, it's "pdfdk" rather than "pdftk" – anddam Nov 26 '13 at 16:52
@anddam: Thanks, good catch. Fixed. – Karolos Nov 27 '13 at 12:16

You can use the Watermark PDF documents action in Automator to add an image on every page of a PDF file. You can specify location, scale, rotation, and opacity.

Manually fixing the workflow for Mac OS X Lion

Set up the entire automator workflow as you would, but skip adding the watermark image (you can't). Save the workflow to a file. Right-click the workflow in Finder and select Show Package Contents and navigate into Contents. Open document.wflow in a text editor, e.g. TextMate.

The actual parameters and their values are stored in the ActionParameters dictionary. The relevant key is filenames. By default, it looks like this:


Just edit the <array/> declaration and add all files as <string>s, like so:


Save the file, and reopen the workflow in Automator. The image will be correctly listed, and you can fix its position and other properties, before you apply it.

Remember that the workflow does not replace the input file as many others do, the output is written to a temporary file. Use the Move Finder Items action afterwards.

Your printer might support a watermark feature via the print dialog. Check for a watermark option in the popup list of the detailed print dialog.

share|improve this answer
The Automator action appears to be broken in Lion. They receive an NSURL from the file dialog, and send the isAbsolutePath message, which is defined for NSString. A really stupid bug. See here. Sorry about that. – Daniel Beck Feb 2 '12 at 0:38
It doesn't look like my printer has that option, but the Automator is definitely worth looking into. (I've never used it before.) Probably won't be able to get to it until tomorrow, so I'll let you know. Thanks! – David Feb 2 '12 at 0:38
Just noticed your recent comment. That might stop it, but it's still worth trying. If I need to, I can probably grab a trial version of a .NET PDF library and develop something custom on my workstation at work. Either way, it'll be tomorrow. – David Feb 2 '12 at 0:39
@David If you're not afraid of XML, I found out how to circumvent the issue. – Daniel Beck Feb 2 '12 at 1:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .