How to Watermark a PDF in Power Automate
Watermarking a PDF document is an effective way of securing its content and/or indicating its status to others. Watermarks themselves can contain logos or other images — but for the most part, the ones we see on a day-to-day basis typically consist of one (or more) semi-transparent text object running diagonally across a page.
Watermarking PDFs can be a repetitive, time-consuming process, especially if we’re faced with applying watermarks to dozens of existing PDFs before storing or sharing those documents in a sensitive (or otherwise exposed) location. It’s a perfect workflow to automate — and it’s especially easy to do so on the Power Automate platform.
In this article, we’ll run through a quick Power Automate flow that applies the same custom watermark across several PDF documents living in the same folder. We’ll use the Cloudmersive PDF connector to handle our watermarking step, which is free to use with a free API key (please note that we’ll also need a premium Power Automate license to access Cloudmersive connectors).
We’ll start by creating a manually triggered, instant cloud flow. This flow option is perfect for document processing workflows involving a batch of files that already live in the same folder.
Since we’re adding watermarks to every PDF document in a specific folder (and we’re assuming this folder ONLY contains PDFs for now), we’ll begin our flow with a List files in folder (OneDrive for Business connector) or List folder (SharePoint connector) action. In my example, I’ll be using a folder in OneDrive, so I’m selecting the former option.
These actions retrieve our file IDs and other useful metadata.
Next, we’ll add a Get file content action.
We’ll use the file IDs retrieved in our initial action to bring PDF file bytes into our flow. Once we select the Id value in the File parameter, Power Automate will wrap our action in a For each control to ensure we get content for each PDF in the Id array.
Within this control, we’ll add our PDF watermarking action. To find this action, we’ll add a new action and search for Cloudmersive connectors, and we’ll look for the Cloudmersive PDF connector on this list.
We’ll click “See more” to reach the connector actions list, and from there, we’ll select the Add a text watermark to a PDF action (the actions list is alphabetical, so this option should come up first).
Once we select this action, we’ll need to use our API key to authorize our connection before we can begin configuring our request. If we have a free API key (which is the tier of API key I’m using in my demonstration), we’ll be able to make a limit of 800 API calls per month with zero additional commitments.
To configure our request, well start by adding our custom watermark text, followed by our PDF file bytes and file names. In my example, I’m adding a watermark that says “Cloudmersive”.
Next, we’ll open the advanced parameters, and here we’ll find options for customizing our watermark text. We can customize the font family, size, color, and transparency level using these options. In my example, I’ll leave all of these settings at their default values so we can see what the generic, baseline output looks like.
The description for the Font Transparency parameter gets cut off — but the default value for this field is 0.5.
Now that we’ve created custom watermarks for each PDF in our folder, we’ll finish our flow by generating the new files.
We can handle this in one of two ways — either by updating the original files, or by creating entirely new files in a different folder. In my example, I’ll go with the latter option.
I’m using a Create file action to save my watermarked PDFs in a folder called “Watermarked PDFs”, and I’m reusing the original file names (with the word “Watermarked” written next to the Display Name dynamic content).
After we’ve finished our Create or Update file actions, we’ll save our flow and run a test. We can then review our watermarked documents in the target folder.
And that’s all there is to it! Now we can easily watermark our PDFs without writing a line of code.