Merge PDF from Forms with images

I've been following this tutorial for my application, and it works fantastic. The only hiccup is that I would like to change the file attachment type from "pdf" to "images." I get a bad request message at the merge PDF action whenever a picture is uploaded. Anyone have any ideas for a workaround?

Hi @dmarucheau,

Probably you can use the Power Automate action * Convert PDF to Image. Otherwise, if you need to merge an image with pdf you firstly need to convert the image to PDF and then merge it with another PDF.

Best regards,
Petr
Plumsail team

I think I was a little unclear, and my apologies, I am a extreme novice. I am taking image uploads from Microsoft forms and merging them with the text string responses from the same form. I like the template I have in Plumsail with the string responses, but am having an issue getting the image array to display correctly. The last step I get creates a merged pdf with the plumsail template and 900 pages of code for the image.

I've been using this guide to try and pass the image into a docx and then convert that subsequent file.

Hello @dmarucheau,

Yes, you need to collect all the images into an array and then replace a tag with the picture formatter;

image

Please share your DOCX template and screenshots of the flow in Edit mode where you create the array and then apply to the DOCX template. It's hard to say why the images are presented as the code. Probably the array is created incorrectly in the flow.

Best regards,
Petr
Plumsail team

Here are my screenshots. I was trying to get the image to insert using the picture formatter for the example and then was going to play with the resizing formats, but haven't been able to get it to work,

imageContent.docx (13.2 KB)

Screenshot 2024-02-05 at 11.33.46 AM



Hello @dmarucheau,

Please try to use the following. When adding images to the image array variable use this expression

body('Get_file_content')['$content']

So, firstly, use the One drive action to get file content, then add a received image to the images array variable using the expression, repeat it in the Apply to each loop while all images are not attached to the array. Then:

I'd also simplify your current flow or create a test one to test the images arrays and isolate the issue.

Best regards,
Petr
Plumsail team

Thank you Petr! I think that expression was the issue. Everything is working great now. Thanks a lot for the detailed help!

1 Like