Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

html to pdf only coverts one file

(0) ShareShare
ReportReport
Posted on by 395

Hi, Iam using a simple flow to convert image and peninput to html, then to pdf in onedrive, then to sharepoint. I have the powerautomate and the html below on one button. Images are saved to a collection then uploaded. The problem iam having is

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>")



  • Matt383 Profile Picture
    Matt383 395 on at
    Re: html to pdf only coverts one file

    Hi Warren, last piece i need to solve, is the html pdf conversion. I have a powerautomate flow that converts to onedrive, then the pdf is sent to sharepoint. I have the flow and html linked to a submit button (see below) and data from powerapps gallery is pulled into the html. The conversion works however, i have two sections that needs multiple line text (Work Instruction and Work Details). I have theses sections in tables and it looks fine in html but once it goes to pdf, text is on the same line. Because its pulling the data in from the gallery, i cant see a way to put <br> that will work. Any ideas?

    This what its doing: aaaaaaaabbbbbbbbbbbbbbbbbbccccccccccccccccccc
    This is what i want it to do: aaaaaaaaa
                                                bbbbbbbb

                                                cccccccccc

     

    PDFconvert-2'.Run("<!DOCTYPE html>
    <html>
    <p><strong>KBX</strong> <em>Mechanical</em></p>
    <hr />
    <p><strong>Date:</strong> "& (CollectGallery.Selected.Date) &"</p>
    <p>&nbsp;</p>
    <table style='height: 59px; width: 564px;' border='1px solid black'>
    <tbody>
    <tr>
    <td style='width: 104px;'><strong>Customer:</strong></td>
    <td style='width: 186.4px;'>"& (CollectGallery.Selected.Customer) &"</td>
    <td style='width: 81.6px;'><strong>Site:</strong></td>
    <td style='width: 166.4px;'>"& (CollectGallery.Selected.Site) &"</td>
    </tr>
    <tr>
    <td style='width: 104px;'><strong>Machine ID:</strong></td>
    <td style='width: 186.4px;'>"& (CollectGallery.Selected.MachineID) &"</td>
    <td style='width: 81.6px;'><strong>KBX Staff:</strong></td>
    <td style='width: 166.4px;'>"& (CollectGallery.Selected.Title) &"</td>
    </tr>
    </tbody>
    </table>
    <p>&nbsp;</p>
    <table style='height: 54px;' border='1px solid black' width='560'>
    <tbody>
    <tr>
    <td style='width: 272.8px;'><strong>Work Instruction</strong></td>
    <td style='width: 272.8px;'><strong>Details of work carried out</strong></td>
    </tr>
    <tr>
    <td style='width: 272.8px;'>&nbsp;"& (CollectGallery.Selected.WorkInstruction) &"</td>
    <td style='width: 272.8px;'>&nbsp;"& (CollectGallery.Selected.WorkDetails) &"</td>
    </tr>
    </tbody>
    </table>
    <p>&nbsp;</p>
    <table style='height: 27px; width: 565px;' border='1px solid black'>
    <tbody>
    <tr>
    <td style='width: 120.8px;'><strong>Company Rep:</strong></td>
    <td style='width: 429.2px;'>"& (CollectGallery.Selected.CompanyRep) &"</td>
    </tr>
    </tbody>
    </table>
    <p><img src="&JSON(CollectGallery.Selected.Signature1, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:120px'></p>
    <table style='height: 22px; width: 564px;' border='1px solid black'>
    <tbody>
    <tr>
    <td style='width: 97.4px;'><strong>Start Time:</strong></td>
    <td style='width: 77.6px;'>"& (CollectGallery.Selected.StartTime) &"</td>
    <td style='width: 100px;'><strong>Finish Time:</strong></td>
    <td style='width: 75px;'>"& (CollectGallery.Selected.FinishTime) &"</td>
    <td style='width: 103px;'><strong>Total Hours:</strong></td>
    <td style='width: 72px;'>"& (CollectGallery.Selected.TotalHours) &"</td>
    </tr>
    </tbody>
    </table>
    <p><strong>Parts:</strong></p>
    <table style='height: 76px;' border='1px solid black' width='564'>
    <tbody>
    <tr>
    <td style='width: 555.2px;'>"& (CollectGallery.Selected.Part1) &"</td>
    </tr>
    <tr>
    <td style='width: 555.2px;'>"& (CollectGallery.Selected.Part2) &"</td>
    </tr>
    <tr>
    <td style='width: 555.2px;'>"& (CollectGallery.Selected.Parts3) &"</td>
    </tr>
    </tbody>
    </table>
    <p><strong>&nbsp;</strong></p>
    <p><strong>Images of work conducted:</strong></p>
    <p><img src="&JSON(CollectGallery.Selected.Image1, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image2, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image3, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image4, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'></p>

    </body>
    </html>")

  • Matt383 Profile Picture
    Matt383 395 on at
    ThRe: html to pdf only coverts one file

    Thanks, it was the double quotation marks around the sizes that was throwing errrors. All good now, cheers

  • WarrenBelz Profile Picture
    WarrenBelz 145,445 on at
    Re: html to pdf only coverts one file

    Hi @Matt383 ,

    My code seems to have not made it through, but it was similar to @v-siky-msft â€˜s so I will leave you with them.

  • Verified answer
    v-siky-msft Profile Picture
    v-siky-msft on at
    Re: html to pdf only coverts one file

    Hi @Matt383 ,

     

    Since you only reference the CollectGallery.Selected.Image1 in your HTML script, there is only one image in the HTML, Please try to use Concat() function to reference all images in collection to one HTML script.

    Concat(CollectGallery,"<img src="& JSON(Image1,JSONFormat.IncludeBinaryData) &" width='550px' height='550px'>")

    Hope this helps.

    Sik

  • WarrenBelz Profile Picture
    WarrenBelz 145,445 on at
    Re: html to pdf only coverts one file

    Hi @Matt383 ,

    I cannot test this so watch minor syntax, but you will get the idea. I am not sure on your Image1.Image reference at the end.

    You also have ">/object>  instead of "</object> at the end

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

     

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,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard