<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reusing IFrame for multiple reports results in incorrect layout in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1189774#M24430</link>
    <description>&lt;P&gt;Ok, it has taken a while to resolve this one, but massive kudo's to the Power BI Support team for solving it.&lt;BR /&gt;I will try and explain things as best as I can - in the hope that this helps someone else in the future.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Issue Recap:&lt;/STRONG&gt;&lt;BR /&gt;Reusing the embedding IFrame for multiple reports results in inconsistent rendering/layouts if the reports have different page sizes.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Issue Reason:&lt;/STRONG&gt;&lt;BR /&gt;Part of the performance benefit of reusing the IFrame is that you don't throw away a lot of the inner HTML. Rendering multiple reports is much faster, but the frame content is FIXED to the size/dimensions of the report that was first rendered.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The Fix:&lt;/STRONG&gt;&lt;BR /&gt;There are a small number of steps to implementing a fix for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)&lt;/STRONG&gt; Ensure that the div/element hosting the Power BI IFrame - is styled to the desired height + width&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2)&lt;/STRONG&gt; Set all reports (+ report pages) at '&lt;STRONG&gt;design time&lt;/STRONG&gt;' to use a page view of 'Fit to Width' - this is set in Power BI Desktop (see below).&lt;BR /&gt;&lt;STRONG&gt;3)&lt;/STRONG&gt; In the embedding code -&amp;gt; When setting the embedded configuration object, add a &lt;STRONG&gt;custom layout&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4)&lt;/STRONG&gt; Set the display option to '&lt;U&gt;Actual Size&lt;/U&gt;'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5)&lt;/STRONG&gt; Set a custom pageSize -&amp;gt; choosing a width + height of '100%'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Important Note: &lt;/STRONG&gt;The custom page size &lt;U&gt;does accept a percentage value&lt;/U&gt; and isn't fixed to a number (pixels).&lt;BR /&gt;This works even if you are using TypeScript definitions like I am, as is not clear from the documentation or published examples.&lt;BR /&gt;This was the deal-breaker!&lt;BR /&gt;&lt;BR /&gt;You should end up with code like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const layoutSettings = {
      displayOption: models.DisplayOption.ActualSize,
      pageSize: {
        type: models.PageSizeType.Custom,
        width: "100%",
        height: "100%",
      }
} as models.ICustomLayout;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;...And the Power BI Desktop page size setting (from step 2 above)&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;You are then in full control over the report dimensions - and you can handle viewports that are larger/smaller than your original report dimensions - and size things as required. The control is within your own applications - and you do not need to keep passing in new report dimensions to the embedding code when things change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had linked another post to this ticket previously: &lt;A href="https://community.powerbi.com/t5/Developer/Report-getPages-returns-incorrect-report-page-dimensions-if/m-p/1041224#M23249" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Developer/Report-getPages-returns-incorrect-report-page-dimensions-if/m-p/1041224#M23249&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Calling 'getPages' will not return the correct report dimensions when reusing IFrames!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, I am happy with the workaround of needing to know (up-front) what the report dimensions are.. and setting them myself in the container that hosts the embedded report.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jun 2020 16:44:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-06-29T16:44:09Z</dc:date>
    <item>
      <title>Reusing IFrame for multiple reports results in incorrect layout</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1030308#M23149</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am making improvements to an app that uses embedded reports.&lt;BR /&gt;Part of this is resuing the embedding iframe to improve load times - as mentioned here: &lt;A title="Power BI Embedded - Performance Best Practice" href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embedded-performance-best-practices#switching-between-reports" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/power-bi/developer/embedded/embedded-performance-best-practices#switching-between-reports&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This initially looks like it will work great... then I hit a number of inconsistencies.&lt;BR /&gt;This also looks like it might be related to another question I have open regarding the 'report.getPages' function. &lt;A title="Issue with GetPages function - Power BI Community" href="https://community.powerbi.com/t5/Developer/Report-getPages-returns-incorrect-report-page-dimensions-if/m-p/1025283#M23112" target="_blank" rel="noopener"&gt;(here)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Reports with different width/height dimensions render incorrectly.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;It looks as though the iframe sticks with the size of the first report rendered - and resetting it - or rendering a different report makes no difference to the report size.&lt;BR /&gt;&lt;BR /&gt;Anyone have any ideas how to resolve this?&lt;BR /&gt;I would really like to continue to reuse the iframe for multiple reports as the performance boost is massive, but it is looking increasingly like it is a non-starter.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 14:19:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1030308#M23149</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-16T14:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing IFrame for multiple reports results in incorrect layout</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1041250#M23250</link>
      <description>&lt;P&gt;I have been able to escalate this with the awesome Power BI support team, and demonstrated the behaviour around this issue (and the &lt;A title="Linked issue" href="https://community.powerbi.com/t5/Developer/Report-getPages-returns-incorrect-report-page-dimensions-if/m-p/1041224#M23249" target="_blank" rel="noopener"&gt;similar issue&lt;/A&gt; of the report.getPages function).&lt;BR /&gt;&lt;BR /&gt;It is now with them to confirm that this is a genuine bug (looks like it is) and recreate the issue at their end.&lt;/P&gt;&lt;P&gt;I will follow up with any progress as it happens.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 08:14:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1041250#M23250</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-22T08:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reusing IFrame for multiple reports results in incorrect layout</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1189774#M24430</link>
      <description>&lt;P&gt;Ok, it has taken a while to resolve this one, but massive kudo's to the Power BI Support team for solving it.&lt;BR /&gt;I will try and explain things as best as I can - in the hope that this helps someone else in the future.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Issue Recap:&lt;/STRONG&gt;&lt;BR /&gt;Reusing the embedding IFrame for multiple reports results in inconsistent rendering/layouts if the reports have different page sizes.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Issue Reason:&lt;/STRONG&gt;&lt;BR /&gt;Part of the performance benefit of reusing the IFrame is that you don't throw away a lot of the inner HTML. Rendering multiple reports is much faster, but the frame content is FIXED to the size/dimensions of the report that was first rendered.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The Fix:&lt;/STRONG&gt;&lt;BR /&gt;There are a small number of steps to implementing a fix for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)&lt;/STRONG&gt; Ensure that the div/element hosting the Power BI IFrame - is styled to the desired height + width&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2)&lt;/STRONG&gt; Set all reports (+ report pages) at '&lt;STRONG&gt;design time&lt;/STRONG&gt;' to use a page view of 'Fit to Width' - this is set in Power BI Desktop (see below).&lt;BR /&gt;&lt;STRONG&gt;3)&lt;/STRONG&gt; In the embedding code -&amp;gt; When setting the embedded configuration object, add a &lt;STRONG&gt;custom layout&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4)&lt;/STRONG&gt; Set the display option to '&lt;U&gt;Actual Size&lt;/U&gt;'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5)&lt;/STRONG&gt; Set a custom pageSize -&amp;gt; choosing a width + height of '100%'&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Important Note: &lt;/STRONG&gt;The custom page size &lt;U&gt;does accept a percentage value&lt;/U&gt; and isn't fixed to a number (pixels).&lt;BR /&gt;This works even if you are using TypeScript definitions like I am, as is not clear from the documentation or published examples.&lt;BR /&gt;This was the deal-breaker!&lt;BR /&gt;&lt;BR /&gt;You should end up with code like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const layoutSettings = {
      displayOption: models.DisplayOption.ActualSize,
      pageSize: {
        type: models.PageSizeType.Custom,
        width: "100%",
        height: "100%",
      }
} as models.ICustomLayout;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;...And the Power BI Desktop page size setting (from step 2 above)&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;You are then in full control over the report dimensions - and you can handle viewports that are larger/smaller than your original report dimensions - and size things as required. The control is within your own applications - and you do not need to keep passing in new report dimensions to the embedding code when things change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had linked another post to this ticket previously: &lt;A href="https://community.powerbi.com/t5/Developer/Report-getPages-returns-incorrect-report-page-dimensions-if/m-p/1041224#M23249" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Developer/Report-getPages-returns-incorrect-report-page-dimensions-if/m-p/1041224#M23249&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Calling 'getPages' will not return the correct report dimensions when reusing IFrames!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, I am happy with the workaround of needing to know (up-front) what the report dimensions are.. and setting them myself in the container that hosts the embedded report.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 16:44:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Reusing-IFrame-for-multiple-reports-results-in-incorrect-layout/m-p/1189774#M24430</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-29T16:44:09Z</dc:date>
    </item>
  </channel>
</rss>

