Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
GSP
Frequent Visitor

How to enable 'Print' option in iframe

HI,

 

We embeded our Power Bi reports using iframe. How to enable 'Print' option here. We have below esport option and that is generating empty file. 

Export optionExport option

Please help

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @GSP ,

Sorry, so far, to my knowledge, this may not be achieveable in PBIRS.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
GSP
Frequent Visitor

Hi,

Noted. Thanks.

 

We are trying the following code shared by Microsoft Copilot

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Power BI Embedded Report</title>
<!-- Include Power BI JavaScript library -->
<script src="https://microsoft.github.io/PowerBI-JavaScript/dist/powerbi.min.js"></script>
</head>
<body>
<!-- Embed the report using an iframe -->
<iframe id="embeddedReport" width="800" height="600" src="https://app.powerbi.com/reportEmbed?reportId=<your-report-id>&groupId=<your-workspace-id>&config=<your-embed-config>"></iframe>

<!-- Custom buttons for print and export -->
<button onclick="printReport()">Print Report</button>
<button onclick="exportToPDF()">Export to PDF</button>

<script>
// Initialize Power BI report
const embedConfig = {
type: 'report',
id: '<your-report-id>',
embedUrl: 'https://app.powerbi.com/reportEmbed',
accessToken: '<your-access-token>',
tokenType: models.TokenType.Embed,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false
}
};

const reportContainer = document.getElementById('embeddedReport');
const report = powerbi.embed(reportContainer, embedConfig);

// Custom print function
function printReport() {
// Capture a screenshot of the report area (you can use external libraries for this)
// Open the browser's print dialog
window.print();
}

// Custom export function (to PDF)
function exportToPDF() {
// Use Power BI REST API to trigger export
// Example: https://api.powerbi.com/v1.0/myorg/groups/<your-workspace-id>/reports/<your-report-id>/ExportTo
// Implement the necessary logic to handle the export
console.log('Exporting report to PDF...');
}
</script>
</body>
</html>

 

Please suggest how can we get the below highlighted access token

const embedConfig = {
type: 'report',
id: '<your-report-id>',
embedUrl: 'https://app.powerbi.com/reportEmbed',
accessToken: '<your-access-token>',
tokenType: models.TokenType.Embed,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false
}

 

Please help

 

Thanks

Anonymous
Not applicable

Hi @GSP ,

Please refer below official documents: 

Permission tokens needed to embed a Power BI app - Power BI | Microsoft Learn , 

Generate an embed token in Power BI embedded analytics - Power BI | Microsoft Learn

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @GSP ,

Sorry, so far, to my knowledge, this may not be achieveable in PBIRS.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

GSP
Frequent Visitor

Hi,

Thank you for your reply.

 

We are embedding our Power Bi reports into our web application in iframes. We used the option File-> Embed Report-> Website or Portal

 

We understand that

If we need to print reports we need to login to app.powerbi.com, need to export the needed reports and need to print. 

We do have the possibility to set up 'Print' option in our website where we embeded our Power Bi reports

 

Could you please confirm this

Thanks

 

 

Anonymous
Not applicable

Hi @GSP ,

When you embed a report in a secure portal or website, user need sign in and need license and permission to view the report, and don't show 'Print' options in the report, please refer below screenshot:

vbinbinyumsft_0-1709106204850.png

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

GSP
Frequent Visitor

Hi,

We have license. We are able to sign in and view the embeded report in website. Our client's requirement to provide a 'Print' option in the website where we embededed our report. So we are checking the posibilities here. Hope this clarifies.

Thanks

Anonymous
Not applicable

Hi @GSP ,

Sorry, so far, to my knowledge, could not set for 'Print' option when you embed a report in a secure portal or website.

Please try to embed report in sharepoint online pages, all toolbars will be show in report.

vbinbinyumsft_0-1709107656806.png

 

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

GSP
Frequent Visitor

HI,

 

Thank you for your reply. We are checking this for one of our client. So do we have any correct link to confirm this is not possible. Please help. 

 

Also, from the following reference links we noticed that we need to have ‘Pro’ account. Is this correct.

https://community.fabric.microsoft.com/t5/Developer/REST-API-Get-Access-Token/m-p/1898039#M29951

https://learn.microsoft.com/en-us/power-bi/developer/embedded/register-app?tabs=customers

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.