cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elseb
Super User
Super User

PDF from multiple gallery items

Hi,

I'm trying to generate printable pdf with list of names pulled from the collection, I've read about the html -> pdf solution using a flow. Html and formatting is no issue, I'm not sure how to create the code for each item in collection though.

There are 2 nametags per page and basic html looks like:

"<div style='width:720px; height:1100px; font-family:sans-serif; font-weight:bold; font-size:100px'>
    <div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center; padding:70px'>Name 1</div>
    <div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center'></div>
    <div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center; padding:70px'>Name 2</div>
    <div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center'></div>
</div>"

 

Now I need to replace name 1 and name 2 with values from collection and do that for the reminder of the collection items.

I can get the names from the collection I just don't have an idea on how to tackle repeating the above code for all the items in the collection so I can then convert it into a pdf.

I'm sorry if the question sounds a bit convoluted, I'm sure I'm overcomplicating it...

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Dual Super User
Dual Super User

@elseb ,

Here is my approach:

 

UpdateContext(
{
   HTMLCode:
   "<div style='width:720px; height:1100px; font-family:sans-serif; font-weight:bold; font-size:100px'>" &
   Concat(
       ForAll(
          YourCollection,
          "<div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center; padding:70px'>"& NameColumn &"</div>
           <div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center'></div>"
       ),
       Value & Char(13)
   ) 
}
)

 

where NameColumn is the column that keeps the values you want to insert (Name1, Name2, Name3, etc.) and Char(13) is used only for a readable HTML code result. 

 

Hope it helps !  

View solution in original post

2 REPLIES 2
gabibalaban
Dual Super User
Dual Super User

@elseb ,

Here is my approach:

 

UpdateContext(
{
   HTMLCode:
   "<div style='width:720px; height:1100px; font-family:sans-serif; font-weight:bold; font-size:100px'>" &
   Concat(
       ForAll(
          YourCollection,
          "<div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center; padding:70px'>"& NameColumn &"</div>
           <div style='border-bottom-style:solid; border-color:#c2c2c2; height:270px; text-align:center'></div>"
       ),
       Value & Char(13)
   ) 
}
)

 

where NameColumn is the column that keeps the values you want to insert (Name1, Name2, Name3, etc.) and Char(13) is used only for a readable HTML code result. 

 

Hope it helps !  

Perfect! it does exactly what I need it's nice simple and clean, I'll use it and learn from that example.

Thank you for the help! 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,890)