logo
Documents & Forms
Microsoft 365 & SharePoint Tools
Classic SharePoint Tools
Documents
Nov 01

How to dynamically create PDF file with multiple images in Power Automate

Customer Support Engineer

Spending hours manually adding sets of images into a single document?.. Doesn't sound like a fun thing to do! And suggested solutions often involve creating complicated workflows, which can get pretty overwhelming. So, what's the alternative?

We wrote this article to show you an easier way to create PDF documents with multiple images in Power Automate using the Plumsail Documents connector.

Contents

Overview of the approach

We'll use a Word template to create a PDF document with multiple images. The logic behind the approach is to use a picture formatter wrapped in a table cell with no borders.

{{Images}:picture} turns into a set of pictures in a document

You can also add dynamic text to each of the dynamic images. As an example, let's add a couple of pictures of buildings along with their descriptions.

The output document displays photos of buildings and their descriptions

You'll be able to add any data you like, collected from any other source.

To demonstrate the approach, we will be creating a DOCX inspection report, but this approach will also work for Excel XLSX and PowerPoint PPTX documents. You can download the inspection report template here.

Setting up the flow to create PDFs with multiple images

We'll create an automated cloud flow that will trigger upon a new Plumsail Web Form submission. Our form features an attachments field that allows you to attach images as part of your submission.

Form is Submitted - Power Automate flow

You can use any other trigger to get the data to populate the template, or you can enter the data manually.

Get file content

We will store our template to create a PDF with multiple images in a SharePoint document library and bring it into the flow using the 'Get file content' action. In our case it will be the DOCX inspection report template we mentioned earlier.

Get file content - Power Automate flow

Create document from DOCX template

Next, we'll add the 'Create document from DOCX template' action from the Plumsail Documents connector. It will populate the template with the data and images from the form submission, and convert it to PDF for us to get the PDF document with multiple images.

Create document from DOCX template - Power Automate flow

Insert the file content into the 'Template file' field, and enter the data in JSON format into the 'Template data' field. Then, set the document output type to 'PDF' to receive the resulting document as a PDF file with multiple images.

Hint: Form submissions return pictures as blob URLs. You can send these blob URLs straight to your template without any additional processing. Alternatively, you can also insert your pictures as base64.

Create file

We'll export the output document to a SharePoint library using the 'Create file' action:

Create file - Power Automate flow

We made filename dynamic using dynamic values received from the form response.

All set! 🎉 Take a look at how the file turned out:

Inspection Report

Conclusion

Hopefully, this has helped you solve your problem with automatically adding multiple images into your documents. If you have any questions, feel free to drop us a line at support@plumsail.com.

Sign up for a one-month free trial if you’re new to Plumsail Documents.