In November last year, we released a new ‘Split PDF‘ action for our Power Automate connector, which allows you to split a PDF document either by several pages, a collection of specific pages or even by the bookmark level (Table of Contents).
What’s not so obvious is that you can use the ‘Split PDF’ action to obtain a specific page or page collection from a document, and this post outlines how to get just the first page of a PDF document.
Example Flow
1. Create a new Flow using the ‘Instant — from blank‘ option
2. Enter a name for the Flow, select the ‘Manually trigger a flow‘ trigger action and click ‘Create.‘
3. Add a ‘Get file content‘ SharePoint action
3.a. Site Address: Enter the location of the SharePoint site where the target file is stored
3.b. File Identifier: Select the source PDF Document
4. Add an Encodian ‘Split PDF‘ action
4.a. Filename: Provide the name of the PDF Document
NOTE: The ‘Filename‘ value will be used to post-fix the name of the resulting documents; for example, source.pdf would return files with names ‘0001_source.pdf, 0002_source.pdf‘ etc.
4.b. File Content: Select the ‘File Content‘ property from the SharePoint ‘Get file content‘ action
4. c. Split by Type: Select the ‘PageArray‘ option
4.d. Split Configuration: Enter ‘[1-1]‘
The ‘Split Configuration‘ value requests a single document which starts on page 1 and finishes on page 1. To extract page 3, the value would be ‘[3-3]’, or two extract pages 3 to 8 and 15 to 22 would be ‘[3-8], [15-22]’, etc. Please visit the actions documentation for further details: ‘Split PDF.’
5. Add a ‘Create file‘ SharePoint action
5.a. Site Address: Set to the value of the SharePoint site, which contains the target document library
5. b. Folder Path: Set to the value of the target SharePoint folder
5. c. File Name: Select the ‘Documents Filename‘ property from the ‘Split PDF‘ Encodian action
Power Automate will automatically wrap the action within an ‘Apply to each’ loop after selecting the’ Documents Filename’ property. This is because the ‘Split PDF‘ action returns an array of documents…for this example, the array will only contain a single document.
5.d. File Content: Select the ‘Documents File Content‘ property from the ‘ Split PDF‘ Encodian action
6. The completed flow should follow this simple construct:
7. Now, let’s test the Flow! Select ‘I’ll perform the trigger action‘ and click ‘Save & Test‘
8. Progress through the following screens and verify the Flow has been executed:
Your new PDF document representing the first page of the PDF document should have been created within the target library:
Finally…
Hopefully, this post outlines succinctly how to extract specific pages from PDF documents and as ever, please share any feedback or comments – all are welcome!
2 Comments
Does this require a SharePoint site or can it work pointing to a local input and output directory?
Hello Frank, there is no dependency on SharePoint (Or any other connector). You simply need to configure Power Automate to pass a file to the Encodian action and then do something with the files generated, i.e. Save to SharePoint, OneDrive, Box, Azure Storage, etc. HTH Jay