I've got a Python 3 script going that will overlay a particular transparent PDF file on top of another for the purpose of watermarking.
Copying and pasting the file location of each PDF into the script each time I want to watermark something is a bit of a headache though. The whole thing is not very flexible despite its great power.
from pdfrw import PdfReader, PdfWriter, PageMerge
ipdf = PdfReader("/users/me/Desktop/meetingminutes.pdf")
wpdf = PdfReader("/users/me/Desktop/private.pdf")
wmark = PageMerge().add(wpdf.pages[0])[0]
for page in ipdf.pages:
PageMerge(page).add(wmark).render()
PdfWriter().write('/users/me/Desktop/meetingminutes.pdf', ipdf)
I would ideally like to be able to right click on a given PDF file in Finder and apply the watermark script to it as a service.
I've done a little bit of tinkering already but the most I've been able to figure out on my own is that I need to run the script as it is (right now) I can make an Automator App with the "Run AppleScript" droplet as the first step.
on run {input, parameters}
do shell script "/usr/local/bin/python3 /users/me/Desktop/script.py
return input
end run
It'd be wonderful to scale this up to work on any given PDF. The actual "watermark" image PDF would be at a fixed location on the hard drive and the files on which the service is applied would not be renamed or moved/copied elsewhere (ideally).