Add a Header to Every Page in a PDF?

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.


Solution 1:

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 TextEdit.app.

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.

Solution 2:

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:

<key>ActionParameters</key>
<dict>
    <key>angle</key>
    <integer>0</integer>
    <key>fileNames</key>
    <array/>
    <key>onePDF</key>
    <false/>

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

<key>fileNames</key>
<array>
        <string>/Users/danielbeck/Desktop/test.png</string>
</array>

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.