Extract Pages from PDF using Power Automate

In this guide you’ll learn how to extract a single page or multiple pages from a PDF using Power Automate. This example can also be used for other file formats by first converting a file to PDF and then extracting either a single or range of pages (see file formats we support).

Prerequisites

Before we start building the workflow, ensure all prerequisites are in place. It is also assumed that the reader has some knowledge of building Workflows using Power Automate.

Please make sure the following prerequisites are in place:

  • An Office 365 subscription with SharePoint Online license.
  • Muhimbi PDF Converter for Power Automate full or free trial subscription.
  • Appropriate privileges to create Flow.
  • Working knowledge of MS SharePoint Online, Microsoft Power Automate.

Using Power Automate to Extract Pages from PDF Documents and Forms

On a high level, the workflow will look as follows:

extract pdf page

  1. Add the ‘For a selected item‘ MS SharePoint trigger action with two mandatory inputs of type ‘Number‘. You can use this trigger to start the Flow and for the user to input the ‘Start Page‘ and ‘End Page‘ manually from the MS SharePoint Online User interface.

for a selected item

  1. Add the ‘Get file properties‘ MS SharePoint action and select the ‘Library Name‘ in which you want to Run the document extraction process and pass the ‘ID‘ value to the ‘Id‘ field.

get file properties

  1. Add the ‘Get file content‘ SharePoint action and pass the ‘Identifier‘ which is the output of ‘Get file properties‘ action into the ‘File Identifier‘.

get file content

  1. Add the Muhimbi ‘Convert document’ action.
  • Source file name: ‘fileName‘ the output of the ‘For a selected file‘ trigger.
  • Source file content: ‘File Content‘ the output of the ‘Get File Content’ action.
  • Output format: Select ‘PDF‘ from the dropdown.
  • **Override settings:

Note: In the above XML, we need to pass the inputs ‘Start Page‘ and ‘End Page

passed by the trigger action.

trigger action

  1. Add ‘Send an email(v2)’ action and configure it with reference to the details below:
  • To: Managers email address.
  • Subject: The file concat(outputs(‘Convert_document’)?[‘body/base_file_name’],’Extacted’,’.pdf’)
  • Body: Email Body.
  • Attachments Name – 1: concat(outputs(‘Convert_document’)?[‘body/base_file_name’],’Extacted’,’.pdf’)
  • Attachments Content -1: ‘Processed File Content’ the output of ‘Convert document‘ action.

send email action

  1. We used the ‘For a selected item’ trigger to manually start a Flow on a document. This works similarly to Flows that are automatically triggered when a file is created or changed, with one major exception, which is that by default the person starting this Flow will need to authenticate to all services used by it.

  2. Navigate to the original library and select an item. Click the Flow dropdown and click the name of the Flow you created. It should open the blade in which you can specify the ‘Start page‘ and ‘End page‘ and then click Run Flow button.

run flow

  1. After a few seconds you will get an email with the Extracted Pages a PDF attachment.

Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2023
This website uses cookies to ensure you get the best experience. Learn more