You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator Watermark PDF Workflow

Seems with every major upgrade, Apple breaks the Automator Watermark PDF Workflow.

Can someone test this workflow in Yosemite so I know if the problem I'm having is with OS X 10.10.

OS X Yosemite (10.10)

Posted on Oct 22, 2014 9:43 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 22, 2014 11:04 AM

I may agree with you. 😠 Can't get it to work as drag/drop application, with a rename after the watermark — or as a Printer plugin as below.


I create a Print plugin in Automator. Two actions:

  • Watermark PDF Documents

    Image: draft.jpg (will not allow you to select a draft.pdf with the chooser, but you can drag/drop one in the well - doesn't work either)

  • Set Application for Files - Preview


Print > PDF > myDraft


User uploaded file

53 replies

Oct 23, 2014 5:31 PM in response to VikingOSX

Hello VikingOSX


As far as I can tell, I had to adjust the values of scale, xOffset and yOffset to let the watermark image (word "Draft") be overlaid correctly on the base pdf. I got these values by trial and error using preview pane of the Automator action (Watermark PDF Documents.action). By the way, the angle parameter is not in radian but degree.


My test watermark.png is generated from Pages 4 document using huge 144 point font, which surely reflects in the specific parameter values I have posted. So I think you may try other scales and offsets or simply try a colour-filled page for watermark, for scale and offsets shouldn't matter much for a whole page to be overlaid somehow.


Good luck,

H


EDIT: fixed typo

Oct 23, 2014 7:42 PM in response to $KMoney$

Copy Hiroto's script into a text editor, save as Watermark.py, then make executable (chmod u+x Watermark.py)

Copy the COPY.PNG file I posted above to the Desktop (right-click, "Save image to the Desktop)


Here's the command I used:


~/Desktop/Watermark.py —under —xOffset 15 --yOffset 55 --angle 0 --scale 0.75 --opacity 0.5 --input "Filename.PDF" —output "FilenameCOPY.PDF" ~/Desktop/Watermark(COPY).png

Oct 23, 2014 8:27 PM in response to Tony T1

Used Hiroto's updated Python script. Used the Waternark.png that you posted. Used your corrected command-line settings. There is no watermark produced, and the len(args) returns 1.


I tried Hiroto's small shell script with its args unchanged except for my input and output filenames. Like above, it runs ok, and there is no watermark on the output PDF.


Can I say frustrated?

Oct 23, 2014 8:46 PM in response to VikingOSX

VikingOSX wrote:


Used Hiroto's updated Python script. Used the Waternark.png that you posted. Used your corrected command-line settings. There is no watermark produced, and the len(args) returns 1.




len(args) sounds like a bad flag — I may still have typo's in my corrected post . Make sure that there are two dashes before the flags for the long args (i.e. —output), or just use the shortcut (i.e, -o)


I now have this in an Automator Run Shell Script:


~/Library/Scripts/Watermark.py \
--under \
--xOffset 15 \
--yOffset 55 \
--angle 0 \
--scale 0.75 \
--opacity 0.5 \
--input "$1" \
--output "${1%.*} (COPY).${1##*.}" \
~/Pictures/Other\ Images/Watermark\(COPY\).png

Oct 24, 2014 5:40 AM in response to Tony T1

Ok. After additional fiddling with the args, I now have watermarks using your Watermark.png and my Draft.png. Since my image is 50% transparency text on a transparent background, it does not act as a screen (dimming the underlying page of text) when placed above. I still could not arrive at any setting that would place either image behind the text, but I can live with that.

Nov 7, 2014 5:12 AM in response to VikingOSX

It works! here is how i did it.


I created a tool_2.py just to don't mess my native watermark with the code that you guys shared.

Then fixed some indentation erros, since python doesn't like miss indentations and was giving errors. here is my file:

http://pastebin.com/hNf8MaLT

Copy this file to your folder at /System/Library/Automator/Watermark\ PDF\ Documents.action/Contents/Resources


Now the watermark workflow so it acts as a print service and show in every document you print:

The file is here but you will need to create your own since it uses my local folders, its attached so you can open and copy things up

Basically it have this shell script:

for f in "$@"

do

/System/Library/Automator/Watermark\ PDF\ Documents.action/Contents/Resources/tool_2.py --input "$f" --output /Users/tiagorodrigues/Downloads/print.pdf --v --over --xOffset 0.0 --yOffset 0.0 --angle 0 --scale 0.24 --opacity 1 /Users/tiagorodrigues/Library/Mobile\ Documents/com\~apple\~CloudDocs/Deepend/Watermark/Smuky\ Papel\ de\ Carta\ V6.png

done


https://www.dropbox.com/sh/56ee5d0xqldjnyb/AAAsYUye18XVTGHiF_pM1LzDa?dl=0


Create a new automation for you with the correct folders and the desired watermark file and fix the scale value if you need to make it the correct size.


Hope you can do it this way.

May 19, 2015 2:26 AM in response to patriqq

Hi!

Thanks to Tony T1 & Hiroto first - great work guys!


I'm used this with previous OSX versions and now under 10.10 it's broken. So I managed to read through these topics here. What I've done so far:


Created a new folder on my desktop which should contain the neccessary files. I downloaded the tool.py from this topic - chmod'ed it and it works within command line:


./tool.py -h

['./tool.py', '-h']

Usage: watermark --input <file> --output <file> <watermark files>...


Using the tool.py manually works great as well:


./tool.py --under --xOffset 30 --yOffset 60 --angle 0 --scale 0.24 --opacity 1 --input test.pdf --output output.PDF vorlage.png

['./tool.py', '--under', '--xOffset', '30', '--yOffset', '60', '--angle', '0', '--scale', '0.24', '--opacity', '1', '--input', 'test.pdf', '--output', 'output.PDF', 'vorlage.png']

--under

watermark under PDF

--xOffset 30

--yOffset 60

--angle 0

--scale 0.24

--opacity 1

--input test.pdf

--output output.PDF


Here it is: http://pastebin.com/WyUPdh7x


Now I created an automator action based on Tony T1's - "Ask for finder objects" - "filter finder objects" - "execute shell sctipt" - it's all in german for me.


Unfortunately I get the error on line 8. I already removed every space after the "\" and I already tried to put everything into one line - no success at all.

Any idea about this?


User uploaded file


Line 8 is the input one. I already replaced that one completely with one from another quote here... no success so far.


Ideas? Thanks a lot!

Automator Watermark PDF Workflow

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.