web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Converting HTML to JPG...
Power Automate
Unanswered

Converting HTML to JPG Query

(0) ShareShare
ReportReport
Posted on by 57

Hello

 

I'm trying to convert a piece of HTML to a JPG file that contains two images but no matter what I try the best I can get is one of the images showing. If I convert it to a PDF I get one image then a slither of the second image further down. If I save and view the HTML file its exactly as I want.

 

The HTML is as follows:

 

 

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src="Image1" style="position:fixed; left:0px; top:0px;"/>
<img src="Image2" style="position:fixed; left:175px; top:101px; width:440px; height:306px;"/>
</body>

 

 

"Image1" and "Image2" I'm getting from OneDrive then converting to Base64 using the DataURI then I'm composing the HTML

 

Any ideas?

 

 

Categories:
I have the same question (0)
  • v-litu-msft Profile Picture
    on at
    Re: Converting HTML to JPG Query

    Hi @StuPower,

     

    You could refer to these steps to store these images in HTML into SharePoint:

    1. use Split() function to split these code by using blank ' ' as the separator, then use Filter array to filter out members contains "src=".

    2. use replace function to remove "src=" and double quotes

    3. use dataUriToBinary() function convert the dataUri to binary.

    4. Create file. Please make sure the file name not the same, or the image just has only one could create.
    Screenshot 2020-12-08 145638.jpg

     

    Screenshot 2020-12-08 151649.jpg

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • StuPower Profile Picture
    57 on at
    Re: Converting HTML to JPG Query

    @v-litu-msft 

     

    Hello, thanks for your help

     

    In compose 2 are you still inputting the datauri from the "get file" as your two outputs?

     

    What is your "Item" in the filter array I'm not getting that option?

     

    Compose 4 is a bit hard to read with the image quality, is that- 

     

    dataUriToBinary(replace(replace(item(),'src=',"),"","))

     

    I'm not sure where "item" is coming from

     

    Thanks

     

     

  • v-litu-msft Profile Picture
    on at
    Re: Converting HTML to JPG Query

    Hi @StuPower,

     

    1. I still input two src, just reproduce your instance.

    2. the item is input manually:

    Screenshot 2020-12-08 170548.jpg

     

    3. the expression is:

    dataUriToBinary(replace(replace(item(),'src=',''),'"',''))

     the third parameter in the replace() function is ' ', there is a blank space in it.

    The item() means the current item in the loop, for more details, please refer to this document:

    Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • StuPower Profile Picture
    57 on at
    Re: Converting HTML to JPG Query

    @v-litu-msft 

     

    Thanks for the clarification. This is now working but is creating two image files

     

    I'm trying to create one image file with both images in it

  • Verified answer
    v-litu-msft Profile Picture
    on at
    Re: Converting HTML to JPG Query

    Hi @StuPower,

     

    I am afraid that combine multiple images into one image is impossible in Flow.

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • fransk Profile Picture
    70 on at
    Re: Converting HTML to JPG Query

    Hi @StuPower 

     

    I have a flow that creates an HTML file from a Powerapps HMTLText control. 

     

    I then add 2 images to the top and bottom using Flow. So I first do 2 x Get File Content from Sp Doc Library and then create variables for both using dataURI.

     

    I then do a Concat to add both images before and after the HMTLText content to create the file. 

     

    I then convert the HTML file to JPG. this creates a JPG with both images and the HTMLText.

     

    I can't add screenshots. Will try a bit later to upload images from Chrome.

     

    Let me know if you need more info.

     

    Cheers

     

    Fransk

     

  • StuPower Profile Picture
    57 on at
    Re: Converting HTML to JPG Query

    @fransk I would be very interested in seeing the screenshot, thanks

  • Community Power Platform Member Profile Picture
    on at
    Re: Converting HTML to JPG Query

    Hi Stu, 

     

    Did you ever get this working? Im tying something similar just now and having no luck

  • StuPower Profile Picture
    57 on at
    Re: Converting HTML to JPG Query

    No afraid not

  • jaigopalsoni Profile Picture
    16 on at
    Re: Converting HTML to JPG Query

    @StuPower @Dybrylla hey anybody found the solution, I also want to use some Birthday image file downloaded from some sites stored in sharepoint as background for my happy birthday message to my colleagues and want to overlay some customized text message for each and send the same as image file in email as greetings on their birthday. Birthday, name, customized message and starting position of message in image, name of image file  is stored in sharepoint list. I first got content from jpeg file, text from SharePoint, composed html, convertef it to pdf, I am getting error when converting pdf to image Please share the flow you have in your use case.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard