Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

html to pdf image resize

(0) ShareShare
ReportReport
Posted on by 395

Hi, I have this html attached to a button which has a flow to convert powerapp data into pdf. The conversion works fine, however the images are randomly sized. I have tried adding the height and width attrib into the img src line (highlighted in red) but with no success. Can anyone please assist

 

PDF.Run("<!DOCTYPE html>
<html>
<body>

<h1>KBX</h1>
<p>Name</p>
<div>"& (CollectGallery.Selected.Title) &"</div>
<div>"& (CollectGallery.Selected.Date) &"</div>
<img src=" & JSON(Signatures.Image, JSONFormat.IgnoreBinaryData ) & ">
<img src=" & JSON(UploadedImage1.Image, JSONFormat.IgnoreBinaryData) & ">

</body>
</html>")

Categories:
  • Matt383 Profile Picture
    Matt383 395 on at
    Re: html to pdf image resize

    thankyou, the solution below works for me.  I have one more problem. When i have multiple files in my collection, it only converts the most recent file (one file only). I am converting the files directly from the gallery (see below). In the powerautomate, in createfile, i am using concat(utcNow(),'yy-MM-ddTHH:mmZ') to create unique filenames but when i hit the button to convert, it only converts one out of all the files in gallery. This is the same in onedrive. Can you please assist?

     

    'PDFconvert-2'.Run("<!DOCTYPE html>
    <html>
    <body>
    <div>"& (CollectGallery.Selected.Title) &"</div>
    <div>"& (CollectGallery.Selected.Date) &"</div>
    <br>
    <br><object data="&JSON(CollectGallery.Selected.Signature1, JSONFormat.IgnoreBinaryData)&" type='image/png' 
    <img width='550px' height='550px' src="&JSON(CollectGallery.Selected.Image1, JSONFormat.IgnoreBinaryData)&"/>
    <img width='550px' height='550px' src=" & JSON(Image1.Image,JSONFormat.IncludeBinaryData) & ">
    /object>
    </body>
    </html>")



  • CU-18081211-6 Profile Picture
    CU-18081211-6 9,261 on at
    Re: html to pdf image resize

    I had a test on my side and I set, with no problem, the image dimensions with someting like this:

     

    ImageConverter.Run(
    "<!DOCTYPE html>
    <html>
    <body>

    <h1>KBX</h1>
    <p>Name</p>
    <img width='550px' height='550px' src=" & JSON(Image1.Image,JSONFormat.IncludeBinaryData) & ">

    </body>
    </html>"
    )

     

    This may be of interest but the HTML / CSS support for OneDrive HTML conversion is not 100%. I notice that it is not very reliable in conversion the use of relative dimensions.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard