cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elseb
Helper III
Helper III

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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,820)