cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
micross
Frequent Visitor

Missing Content from HTML to PDF convert

I'm trying to create  a PDF dynamically filled in with content from a single item in a gallery.

 

So far I have run into two problems: (1) consistently missing content and (2) content that is sometimes included but sometimes missing.

 

Because there is content that is sometimes converted and other times not, without changing the html, I'm not sure what the problem is. In my experience when the html to pdf  conversion runs into an issue it's usually the html code. However, I cannot find what is wrong in my code. Would y'all mind taking a look?

 

I've attached V1 and V2 of the html and pdf. V1 includes one piece of information "will be attending friday sessions" and V2 does not. There is no difference in the html code between the two. Beyond that I am missing most of the content that is supposed to be on this page, as you can see between the html and pdf versions.

 

Here;s the html:

 

 

<!DOCTYPE html>
<html lang='en'>
<head>
  <link rel='preconnect' href='https://fonts.googleapis.com'>
  <link rel='preconnect' href='https://fonts.gstatic.com' crossorigin>
  <link href='https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,700;0,900;1,300;1,400;1,900&display=swap' rel='stylesheet'> 

</head>

<body>

<div style='"& 'top-bar'.HtmlText &"'>
  <table style='width:100%;'>
    <tr>
        <td><img src=" & logoVar &" width = '88' height = '32'></td>
        <td style='vertical-align: top;'>
            <h3>
            FirstStepStaffing.com  
            </h3>
       </td>
    </tr>
 </table>
</div>

<div style='" & titlerow.HtmlText & "'>
  <h1 style='" & titlerowText.HtmlText & "'> Resource Referral Form</h1>
</div>

<div>
  <h3 style='" & headingborder.HtmlText & "'> Client Information </h3>
  <table style='border: #1f1f1f 1px solid; width:100%; padding-bottom: 20px;'>
    <tr style='width:100%'>
      <th style='" & newsubbox.HtmlText & "'>"
        & ClientFirstName.Text & "
      </th>
      <th style='" & newsubbox.HtmlText & "' >"
        & ClientLastName.Text & "
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & ClientPhone.Text & "
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & ClientEmail.Text & "
      </th>
    </tr>
    <tr  style='width:100%;'>
      <td  style='" & newsubbox.HtmlText & "'>
        First Name
      </td>
      <td style='" & newsubbox.HtmlText & "'>
        Last Name
      </td>
      <td style='" & newsubbox.HtmlText & "'>
        Phone
      </td>
      <td style='" & newsubbox.HtmlText & "'>
        Email
      </td>
    </tr>
  </table>
</div>

<div>
  <table style='border: #1f1f1f 1px solid; width:100%; padding-bottom: 20px;'>
    <tr  style='width:100%;'>
      <th style='" & newsubbox.HtmlText & "'>
        Referer Information:
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & ReferrerFirstName.Text & " " & ReferrerLastName.Text & "
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & ReferrerPhone.Text & "
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & ReferrerPhone.Text & "
      </th>
    </tr>
  </table>
</div>


<div>
  <h3 style='" & headingborder.HtmlText & "'> Service Information</h3>
  <table style='border: #1f1f1f 1px solid; width:100%; padding-bottom: 20px;'>
    <tr  style='width:100%;'>
      <th style='" & newsubbox_3.HtmlText & "'>" 
         & BrowseGallery1.Selected.Organization_Name &"
      </th>
      <th style='" & newsubbox_3.HtmlText & "'> "
        & AcceptedService.Text&"
      </th>
      <th style='" & newsubbox_3.HtmlText & "'>"
        & AcceptedTraining.Text&"
      </th>
    </tr>
    <tr  style='width:100%;'>
      <td style='" & newsubbox_3.HtmlText & "'>
        Organization Name
      </td>
      <td  style='" & newsubbox_3.HtmlText & "'>
        Service Provided
      </td>
      <td  style='" & newsubbox_3.HtmlText & "'>
        Training Provided
      </td>
    </tr>
  </table>

  <table style='border: #1f1f1f 1px solid; width:100%; padding-bottom: 20px;'>
    <tr>
      <td style='" & newtext.HtmlText & newsubbox_3.HtmlText & "'>
        Program Notes: 
      </td>
      <td style='" & newsubbox_2.HtmlText & "'>"
        & ProgramSpecificNotes.Text &      
    "</td>
    </tr>
  </table>

  <table style='border: #1f1f1f 1px solid; width:100%; padding-bottom: 20px;'>
    <tr  style='width:100%;'>
      <th style='" & newsubbox.HtmlText & "'>"
        & AcceptedContact.Text&"
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
         & AcceptedPhone.Text & "
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & AcceptedEmail.Text &"
      </th>
      <th style='" & newsubbox.HtmlText & "'>"
        & BrowseGallery1.Selected.Website & "
      </th>
    </tr>
    <tr  style='width:100%;'>
      <td style='" & newsubbox.HtmlText & "'>
        Direct Contact
      </td>
      <td style='" & newsubbox.HtmlText & "'>
        Phone
      </td>
      <td style='" & newsubbox.HtmlText & "'>
        Email
      </td>
      <td style='" & newsubbox.HtmlText & "'>
        Website
      </td>
    </tr>
    <tr  style='width:100%;'>
      <th style='" & newsubbox_1.HtmlText & "'>"
        & BrowseGallery1.Selected.Address &"
      </th>
      <td style='" & newsubbox_1.HtmlText & "'>
        Address
      </td>
    </tr>
  </table>
</div>


<div>
  <h3 style='" & headingborder.HtmlText & "'> Additional Client or Referral Notes </h3>
  <p style='" & newPtext.HtmlText & "'>"
  & ClientSpecificNotes.Text & 
  "</p>
</div>  

</body>

 

 

And here's the css that it has included.

These are saved in labels in the powerapp, but here are fomatted as a css file for easier viewing:

 

 

.top-bar {
  width: 100%;
  height: 7%;
  overflow-y: auto;
  background-color: #2e8d9e;
  color: #1F1F1F;
}

body {
  margin: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}

.titlerowText {
  color:#1F1F1F;
  font-weight: bold;
font-size: 25px;
text-align: center;
}

.titlerow {
  border-color: #1F1F1F;
border-style: solid;
border-width: 1px;
}

.newsubbox {
  width: 20%;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  text-align: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.newsubbox_3 {
  width: 30%;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  text-align: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.newsubbox_2 {
  width: 65%;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  text-align: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.newtext {
  color:#1F1F1F;
  font-weight: bold;
  font-size: 16px;
}

.newsubbox_1 {
  width: 90%;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  text-align: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.headingborder{
  border: #1F1F1F 2px solid;
  padding: 10px;
}

.newPtext{
  font-size: 13px;
  text-align: left;
  padding: 10px;
}

 

 

See the attached V1 HTML and PDF images, as well as V2 HTML. The V2 PDF is below  (you can only upload three files 🙄)

V2_PDF.png

5 REPLIES 5
WarrenBelz
Most Valuable Professional
Most Valuable Professional

Hi @micross ,

Without going into the details of your code, I can tell you that CSS and the PDF in OneDrive "are not best friends" and what you are seeing is not unusual, particularly with the complexity of some of it. and I have always kept my HTML tables simple with nothing but tables, borders and font bold/italic etc. If I want to produce a stylised PDF, I use a Word merge, which give almost complete freedom of how it looks.

 

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.

Visit my blog Practical Power Apps

@micross 

To add what @WarrenBelz mentioned...converting the html to PDF in your PowerAutomate via the free convert to pdf option is a bear!  First, you need to provide all of your css styles in your html.  It cannot be referenced.  

Some styles will not work (the PDF conversion engine is old and will only do some basics).

 

To add to my point about the css styles above, is they are on the tags in your html, they will most likely not be honored.  The PDF converter will want them as embedded styles and will ignore (not in all cases) the inline styles on the tags.

 

To get it right, you need to really design your html outside of the app.  What I have had to do in the past is to create a simple flow that just converted a file once changed.  Then, in an editor I would alter the html file accordingly...then look at the resultant PDF until I hit the magic combination that is needed for the conversion engine to work properly.

 

I will also add that this was only in cases where the client did not want to pony up another $15 or so a month to subscribe to the Plumsail Documents connector Which does a most excellent job of generating PDF's.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you both for the feedback!

Thank you both for the feedback! Can you say a little more about word merge?

WarrenBelz
Most Valuable Professional
Most Valuable Professional

Hi @micross ,

As I mentioned, it is a Premium connector and needs Power Automate, but is it fairly straight-forward. You construct a Word Template with the design you need and add the merge fields as you would in any Word Merge, then store the Template in in a SharePoint Library. You then send the fields to the Flow, select the Template and merge the file. The connector also has a PDF convertor which works well. 

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,576)