We’ve been working hard over the past few months, adding performance optimisations and 10+ new actions to the Encodian connector.
Here are our two newest actions. These enable the conversion of a PDF file into either an array of images (one image per page) or a single multi-page TIFF:
Convert a PDF file to a variety of images
The ‘Convert PDF to Images‘ action accepts a single PDF file and returns an array of images pertaining to the configuration supplied. Power Automate converts each page within the PDF document to a single image, which is why a collection (array) of image files is returned. Let’s set up a really simple flow showcasing how to use this action. So that when a PDF document is added to a specific folder, the flow automatically converts the document.
1. Create a new ‘Automated cloud flow.‘
1.a. Flow name: Provide a name for your flow
1.b. Trigger: Select the ‘When a file is created in a folder‘ SharePoint trigger action
1.c. Click ‘Create‘
2. Configure the ‘When a file is created in a folder‘ SharePoint trigger action as required.
3. Add a trigger condition to the ‘When a file is created in a folder‘ to ensure the flow is only triggered when a PDF document is added. We’ll add this trigger condition: @endswith(triggerOutputs()?[‘headers/x-ms-file-name’], ‘pdf’)
Reference: Create Power Automate Trigger Conditions Simplified
4. Add the Encodian ‘Convert PDF to Images‘ action
4.a. File Content: Select the ‘File Content‘ property provided by the ‘When a file is created in a folder‘ SharePoint trigger action
4.b. Image Format: Select the required image format
4.c Filename Prefix: Optional – Add a filename prefix for the filename value of the image files generated. I have used the following expression which essentially takes the source filename and removes the file extension: replace(triggerOutputs()?[‘headers/x-ms-file-name’],’.pdf’,”)
5. Add the SharePoint ‘Create File‘ action
5.a. Site Address: Set as per the trigger actions value or the target site which will store the image files
5.b. Folder Path: Select the folder
5.c. File Name: Select the ‘Documents Filename‘ property provided by the Encodian ‘Convert PDF to Images‘ action
NOTE: Power Automate will automatically create an ‘Apply to each‘ loop and place the ‘Create file‘ action inside because the Encodian action is returning an array.
5.d. File Content: Select the ‘Documents File Content‘ property provided by the Encodian ‘Convert PDF to Images‘ action
The flow is now complete and should follow this construct:
Test your flow. Validate that the PDF document added to the target SharePoint library has been converted into an array of images:
and post flow execution:
Convert a PDF file to a TIFF file
The ‘Convert PDF to TIFF‘ action accepts a single PDF file and returns a single TIFF file pertaining to the configuration supplied. Let’s set up a really simple flow showcasing how to use this action. For this example, the flow automatically performs the conversion when a PDF document is added to a specific folder.
1. Follow steps 1 > 3 in the ‘Convert a PDF file to an array of images‘ section of this post
2. Add the Encodian ‘Convert PDF to TIFF‘ action
2.a. File Content: Select the ‘File Content‘ property. The ‘When a file is created in a folder‘ SharePoint trigger action allows access to this.
2.b. Filename: Either select a dynamic property (the file extension will automatically change to TIFF) or manually enter a filename
5. Add the SharePoint ‘Create File‘ action
5.a. Site Address: Set as per the trigger actions value or the target site which will store the image files
5.b. Folder Path: Select the folder
5.c. File Name: Select the ‘Filename‘ property provided by the Encodian ‘Convert PDF to TIFF‘ action
5.d. File Content: Select the ‘File Content‘ property provided by the Encodian ‘Convert PDF to TIFF‘ action
The flow is now complete and should follow this construct:
You can now test your flow and validate that Power Automate has converted the PDF document added to the target SharePoint library into a TIFF file:
and post flow execution:
Final thoughts…
Hopefully, this post provides a few good examples of how you can utilise the new Encodian Convert PDF to Images and Convert PDF to TIFF actions within Power Automate to automatically convert PDF files to image file formats.
We hope you’ve found this guide useful. As ever please share any feedback or comments, all welcome!