Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 3x5WJGaz4LN76i9VWc7CX+
Power Automate - Building Flows
Answered

Converting HTML to JPG Query

Like (0) ShareShare
ReportReport
Posted on 7 Dec 2020 17:56:34 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?

 

 

  • jaigopalsoni Profile Picture
    16 on 29 Jan 2024 at 23:37:56
    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.

  • StuPower Profile Picture
    57 on 20 Jul 2021 at 14:58:42
    Re: Converting HTML to JPG Query

    No afraid not

  • Community Power Platform Member Profile Picture
    on 07 Jul 2021 at 14:09:41
    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 04 Feb 2021 at 11:09:35
    Re: Converting HTML to JPG Query

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

  • fransk Profile Picture
    70 on 25 Jan 2021 at 16:35:28
    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

     

  • Verified answer
    v-litu-msft Profile Picture
    on 09 Dec 2020 at 09:20:17
    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.

  • StuPower Profile Picture
    57 on 08 Dec 2020 at 09:56:01
    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

  • v-litu-msft Profile Picture
    on 08 Dec 2020 at 09:10:04
    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 08 Dec 2020 at 08:59:07
    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 08 Dec 2020 at 07:24:03
    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.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard