How to Rasterize and Password-Protect your PDFs in Power Automate

Cloudmersive
6 min readJan 21, 2025

--

Securing PDF documents can be challenging without access to dedicated PDF reader applications. If you’re interested in taking basic PDF security steps — like rasterizing our PDFs (converting them to image-based documents) or applying encryption and password protection policies — you might be better off solving your problem in Power Automate.

Applying policies to PDFs via Power Automate

In Power Automate, you can use a combination of SharePoint/OneDrive & Cloudmersive connectors to build a single flow that both rasterizes and locks a PDF document with encryption and password protection policies. You can make this flow reusable by creating a basic manual input trigger; you’ll find it in your Power Automate flow page whenever you need it again in the future.

Below, we’ll walk through an example flow that follows the above steps, and we’ll prompt a user to input their own PDF & password information to trigger the flow.

Create an Instant cloud flow with a manual trigger

We’ll start by creating a manually triggered Instant cloud flow on the Power Automate Create page.

Customize inputs in the manual trigger step

On the flow diagram page, we’ll open our trigger step and create three inputs: one file input, and two text string inputs.

The file input will prompt flow users to select a file from their file system, and the string inputs will ask for reader and owner document passwords.

Locate the Cloudmersive PDF connector

Next, we’ll add a new action and search for Cloudmersive connectors. We’ll locate the Cloudmersive PDF connector with the pink logo.

Locate the Rasterize PDF action

We’ll click “See more” to view the actions list, and from there, we’ll locate an action titled Rasterize a PDF to an image-based PDF (note — we can see this action in my actions list preview in the screenshot above; you might not see this action right away when you find this connector).

Create a Cloudmersive PDF connection

After we select this action, we’ll create our Cloudmersive PDF connection with a free Cloudmersive API key. To get a free API key, we’ll visit the Cloudmersive website and create a free account (this allows a limit of 800 API calls per month with no additional commitments).

Configure the PDF rasterization action

To configure our request parameters, we’ll enter dynamic content from our manual file input trigger in the Input file field, and we’ll then enter the dynamic file name in the (file name) field. The file bytes and file name value should be clearly labeled in our dynamic content window.

Return to the Cloudmersive PDF connector

Our next flow action will encrypt and password protect the rasterized version of the user input PDF. We’ll handle encryption and password protection using another Cloudmersive PDF connector action (note — our PDF connection is now saved, and we won’t have to create a connection again).

Search for the PDF encryption & password-protection action

After we navigate back to the Cloudmersive PDF connector actions list, we’ll search for an action titled Encrypt and password-protect a PDF. We’ll select it once we find it.

Configure the PDF encryption & password-protection action

We’ll now pass our rasterized PDF file bytes to the Input file field, and we’ll re-use the PDF name from our manual trigger step in the (file name) field.

Next, we’ll navigate down to the Advanced parameters and click “Show all” to view our options.

Here, we can enter dynamic content corresponding to the reader and owner passwords we asked our flow users to provide. We can choose from two different encryption algorithms — 128-bit RC4 and 256-bit AES encryption — but it’ll default to the latter if we leave it blank.

Create a new PDF (or update the original PDF)

To wrap up our flow, we can either create a new file with our output PDF content (Create file action), or we can choose to update/overwrite the original input file with our output PDF content (Update file action).

In this example, we’ll use a Create file action and write the rasterized, encrypted & password-protected PDF to a SharePoint team site folder.

As shown in the above screenshot, we can reuse the original file name to name our new file, and we can add an additional string (e.g., “secured_”) before the name value to differentiate it from the original.

Save and test the flow

We’ll now save and test our flow. That means we’ll need to select a PDF from our system and provide reader and owner passwords.

When our flow finishes running, we’ll find our new secured document iteration stored in the folder we selected. Note that our flow run times can vary dramatically depending on the traffic Power Automate and Cloudmersive servers are experiencing at any given time.

Check for password-protection and rasterization

When we open this document, we’ll find a prompt asking us to enter a password.

We can test this with either our reader or owner password; both should work & decrypt the document for us to view.

We can tell the PDF is rasterized by using a CTRL+F search to find a word in our file.

In this example, we’ll search for the word “standard”, which appears immediately at the top of the example document.

We can’t search for text in rasterized PDF documents without OCR services; the PDF text object no longer exists in this version of the document.

Our PDF is now secured with two policies in one quick Power Automate flow.

Conclusion

In this article, we learned how to rasterize our PDF documents, encrypt them, and password-protect them in a single Power Automate flow. We made this flow reusable with manual triggers so members of our team could use the flow whenever the need arises.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet