Optimize PDF size using Power Automate

Sometimes you need to reduce a PDF file size and it’s easy to do with Compress PDF document from Plumsail Documents package.

In this example, we will work with files from a SharePoint documents library and use the default SharePoint trigger and actions. You can use some other system. Power Automate (Microsoft Flow) has a lot of connectors for different systems. Here are just a few of them:

  • SharePoint

  • Box

  • OneDrive

  • Google Drive

  • Dropbox

  • SFTP

  • File System

You can use the pre-built Flow template or follow the steps outlined in the article to create your Flow from scratch.

This is what your flow would look like:

Compress PDF flow

Setting up the Flow

The following steps will guide you through creating the flow step-by-step.

Flow trigger

Choosing a trigger is up to you. For our scenario, we will use the When a file is created or modified in a folder trigger:

When a file is created or modified in a folder trigger

Compress PDF document

Compress PDF document is an action from the Plumsail Documents connector.

If this is your first time using the Plumsail Documents connector, Power Automate will request the Connection Name and API Key.

Create connection in Power Automate flow

You can type any name for the connection, for example Plumsail Documents.

Once the connection name is filled out, create an API key in your Plumsail Account, copy and paste it into the Access Key field, and then click Create.

Copying an API key from the account

The action will receive the file content that was extracted from our trigger:

Compress PDF document action

Create file

Once the file is compressed, we will save it to SharePoint using the Create file action. Feel free to choose any other action to export the file.

Create compressed PDF

Note

Make sure to specify the .pdf extension in the File name field.

We showed one simple example where you can use Compress PDF document action. The same action could be used to compress many PDF files in one flow. You can get all files from one folder and compress them in a loop.

Ready-to-use Flow template

We have simplified the process of Flow configuration for you. Below is a clickable widget of the template that you can use: