<?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: Custom HTML Button to Print Embedded Report in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-HTML-Button-to-Print-Embedded-Report/m-p/3397986#M7900</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTML Content doesn't support scripting, and I don't have any plans to include support for this, as I can't supply any tools for debugging scripts if they fail. Custom visuals also have very limited abilities due to the sandboxing that Microsoft imposes upon them for security reasons, so there's a lot of Javascript that won't work and that can make it more confusing for anyone attempting to reproduce something inside it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also because custom visuals are sandboxed iframes, they don't know anything about the rest of the report. Even if you could action the print dialog via scripting, you would only be able to print the visual itself and not the rest of the visuals on the report page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not very familiar with Power BI embedded, but you would likely need to code the functionality to an element (e.g. a button) within the page that hosts your report. &lt;A href="https://learn.microsoft.com/en-us/javascript/api/powerbi/powerbi-client/report.report#powerbi-client-report-report-print" target="_self"&gt;It looks like there is a print method that can be used&lt;/A&gt;. The folks that work with Power BI Embedded frequent the Developer forum on these community boards, so you may have more luck posting your request there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2023 23:12:45 GMT</pubDate>
    <dc:creator>dm-p</dc:creator>
    <dc:date>2023-08-24T23:12:45Z</dc:date>
    <item>
      <title>Custom HTML Button to Print Embedded Report</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-HTML-Button-to-Print-Embedded-Report/m-p/3395164#M7896</link>
      <description>&lt;P&gt;I have quite a few embedded reports that users need to be able to click a button and print the full report. I have GCC so I cannot use Power Automate. I saw where I could add the "HTML Content" visual to add a customized print button. I added that then added the following measure for the visual:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;HTMLButton =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"&amp;lt;html&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Print Button&amp;lt;/title&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;lt;style&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .print-button {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; background-color: #a0d1ff;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; border-color: #118dff;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; border-style: solid;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; border-width: 3px;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; color: black;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; padding: 4px 30px;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; text-align: center;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; display: inline-block;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font-family: Segoe&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font-size: 9px;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cursor: pointer;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; margin: 4px 2px;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/style&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;/head&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;body&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;div id='report-container'&amp;gt;&amp;lt;/div&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;div class='print-button' onclick='printReport()'&amp;gt;&amp;lt;b&amp;gt;Print&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;lt;script&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; function printReport() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; var element = document.getElementById('report-container');&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; var report = powerbi.get(element);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; report.print();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;/body&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;/html&amp;gt;"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The button looks great but when I click on it from within the embedded report, nothing happens. Any ideas how to fix this, or any ideas on how to print an embedded report?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Aug 2023 15:27:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-HTML-Button-to-Print-Embedded-Report/m-p/3395164#M7896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-23T15:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Custom HTML Button to Print Embedded Report</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-HTML-Button-to-Print-Embedded-Report/m-p/3397986#M7900</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTML Content doesn't support scripting, and I don't have any plans to include support for this, as I can't supply any tools for debugging scripts if they fail. Custom visuals also have very limited abilities due to the sandboxing that Microsoft imposes upon them for security reasons, so there's a lot of Javascript that won't work and that can make it more confusing for anyone attempting to reproduce something inside it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also because custom visuals are sandboxed iframes, they don't know anything about the rest of the report. Even if you could action the print dialog via scripting, you would only be able to print the visual itself and not the rest of the visuals on the report page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not very familiar with Power BI embedded, but you would likely need to code the functionality to an element (e.g. a button) within the page that hosts your report. &lt;A href="https://learn.microsoft.com/en-us/javascript/api/powerbi/powerbi-client/report.report#powerbi-client-report-report-print" target="_self"&gt;It looks like there is a print method that can be used&lt;/A&gt;. The folks that work with Power BI Embedded frequent the Developer forum on these community boards, so you may have more luck posting your request there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 23:12:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-HTML-Button-to-Print-Embedded-Report/m-p/3397986#M7900</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2023-08-24T23:12:45Z</dc:date>
    </item>
  </channel>
</rss>

