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 a number of 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 pages collection from a document, and this post outlines how to obtain just the first page of a PDF document.
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 is requesting a single document which starts at page 1 and finishes at 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. For further details please visit the actions docoumentation: ‘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
Upon selected the ‘Documents Filename‘ property Power Automate will automatically wrap the action within an a ‘Apply to each‘ loop. 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 executed:
Your new PDF document representing the first page of the PDF document should have been created within the target library:
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!