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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Generating pdf with pi...
Power Apps
Answered

Generating pdf with pictures

(0) ShareShare
ReportReport
Posted on by 86

Hi,

 

is it possible to generate pdf with pictures and set size of images? 

I have tried a lot of things to do it, but nothing had worked. 

 

I generate html file from powerapps by flow. This works good and in these html files I could also see the image in the size I have given them. But then when I convert this files to pdf the images do not have the size I wanted. It is in the original size.

 

Are there any ways how to solve this problem?

 

Thanks,

George

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @JiriS 

     

    To avoid this, I would recommend you to keep all the elements in the html file to a width below 500px. Set up the page configuration where everything is covered in 500px and then when you convert it to pdf, the file will be created as expected.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @JiriS 

     

    Does this happen no matter what the width and height of the image was originally - and does this happen even if you make the image smaller, bigger, or any combination?

     

    If you resize the image, let's say it's 300px by 300px and you resize it to 100px by 100px - do you also get this issue then too?

  • JiriS Profile Picture
    86 on at

    Hi @yashag2255 ,

     

    probably it doesn't work, but I am not really sure if I have the html good written.

    Can you please give me the example of html with picture in your solution? 

     

    Thank you so much

    J.

  • JiriS Profile Picture
    86 on at

    Hi @poweractivate ,

     

    the picture in pdf is in the original size no matter how big was the image in html. 

    For example I have big picture and I generate pdf. In this pdf the picture is bigger than the pdf no matter than I have given the size to the picture in html. When I make it smaller then the picture is in the size I have given to it in painting.

     

    It doesn't obey by my text in html.

     

     

     

  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @JiriS 

     

    An Example of how I created an Image and converted it to pdf:

    <!DOCTYPE html>
    <html>
    <body>
    <br><br>
    <img src="@{dataUri(body('Get_file_content_using_path'))}" width="150" height="35" align="left" style="padding-left:20px">
    <br><br>
    <h2 align="left" style="font-size:15px;padding-left:20px;font-weight: bold;font-family:'verdana';" width="350" height="10">Test Text1</h2>
    <hr align="left" size = "3" width="520" style="padding-left:40px" style="">
    <h4 style="font-size:15px;padding-left:20px;font-family:'verdana';">TestText2</h4>
    <h4 style="font-size:15px;padding-left:20px;font-family:'verdana';">@{formatDateTime(utcNow(),'dddd, dd MMMM yyyy')}</h4>
    <h4 style="font-size:15px;padding-left:20px;font-family:'verdana';">TextText3</h4>
    <hr align="left" size = "3" width="520" style="padding-left:20px" style=""><table align="left" width="500px" style="border-collapse:collapse;padding-left:20px">
    <tr>
    <td><img src="@{dataUri(body('Get_attachment_content1'))}" width="250px" height="250px" ></img></td>
    <td valign="top"><p width="220px" style="word-break: break-all" valign="top"><center>@{utcnow()}</center></p></td>
    </tr>
    <tr>
    <td valign="top"><hr valign="top"></td>
    <td valign="top"><hr valign="top"></td>
    </tr>
    <tr>
    <td><img src="@{dataUri(body('Get_attachment_content2'))}" width="250px" height="250px" ></img></td>
    <td valign="top"><p width="220px" style="word-break: break-all" valign="top"><center>@{utcnow()}</center></p></td>
    </tr>
    <tr>
    <td valign="top"><hr valign="top"></td>
    <td valign="top"><hr valign="top"></td>
    </tr>
    </table>
    </body>
    </html>

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • JiriS Profile Picture
    86 on at

    Thank you so much,

     

    Now it works fantastic.

    Thanks.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    How can we generate pdf for multiple records one at a time with images in it.
    The above code works only for a single selected record.
    could any one give the solution

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard