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)
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.
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
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)
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:
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)
Print > PDF > myDraft
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
I must have used an incorrect flag last night. Hiroto's code works in 10.10
Tony,
I've tried pasting in Hiroto's solution into the terminal but it doesn't seem to make a difference. I still get the same error every time I try to run the watermark tool. Is there a way you could walk a noob through the last step or two?
Thanks!
KH
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
Typos, in above, -under s/b —under (or -u) and -xOffset s/b —xOffset (or -x), - output s/b —outptut (or -o):
~/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
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?
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
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.
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:
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.
Just be aware that your solution may break again with the next OS X update.
You can prevent this by putting your tool_2.py in your local Library (or other) folder.
True, thanks for the warning. I will make a backup of it but hope apple get a oficial fix soon.
In my case, I want to get rid of the original file and replace it with a watermarked file with the same filename. This can be done with the following AppleScript. You don't need to "Dispense Items Incrementally" with this. Note I am moving the original file to an arbitrary folder called trashFolder.
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?
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