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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Printing and Navigating to particular page not working


Hi All,

 

I am using Power BI JavaScript API's to integrate Power BI reports (deployed in service) into an ASP.Net MVC web application. I am stuck with below two issues. Could anyone please provide pointers on how to resolve them.

 

Printing issue:
I am using the below code to print a Power BI report,

 

// Get a reference to the embedded report HTML element
var reportContainer = $('#reportContainer')[0];

// Get a reference to the embedded report.
report = powerbi.get(reportContainer);

// Trigger the print dialog for your browser.
report.print()
.then(function (result) {
Log.log(result);
})
.catch(function (errors) {
Log.log(errors);
});

 

Using above the print works well in Chrome, but does not work correctly in IE 11 (version 11.0.9600.18665). It prints the entire web page (with web application menus, logo,footer etc.) instead of the iframe which holds the Power BI report.

When I right click on the report and print, then the print is some what better i.e. it prints out only the iframe but it cuts the report from left and right by some margin. I even tried to use Landscape mode instead of the Portrait but no luck.

 

Incidently the site https://microsoft.github.io/PowerBI-JavaScript/demo/code-demo/index.html too does not print the report correctly it prints out the whole page.

 

Navigate to particular page issue:

 

I am using the below code to navigate to a particular page in report when a user clicks on particular menu item.

// Get a reference to the embedded report HTML element
var reportContainer = $('#reportContainer')[0];

// Get a reference to the embedded report.
report = powerbi.get(reportContainer);

 

var menuName = "Test Page";

 

report.getPages()
.then(function (reportPages) {
pages = reportPages;
for (var i = 0; i < pages.length; i++) {
if(pages[i].displayName.trim() == menuName.trim())
{
pages[i].setActive();
}
}

});

 

However this code works well in Chrome, but in IE 11 it does not work at all. I have also tried setPage(pagename) function to achive this, but it does not work.

 

Thanks,

Vinayak

7 REPLIES 7
tpatel
Frequent Visitor

Was this ever resolved?

Anonymous
Not applicable

@tpatel, the issues are still outstanding in IE browser.

v-viig
Community Champion
Community Champion

Promise is not supported by IE11 since this is pretty modern feature.

If you want to use Promise (then, catch) you should load a polyfill such as Bluebird.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

tpatel
Frequent Visitor

Was this ever resolved?

tpatel
Frequent Visitor

Was this ever resolved?

Eric_Zhang
Employee
Employee

@Anonymous

Thanks for reporting that. What are the output in the "Console" tab in the dev tool(F12) in IE?

 

 

Anonymous
Not applicable

Hi @Eric_Zhang,

 

Thank you for the reply. Please see below errors logged in console.

 

Printing issue:

SCRIPT5009: 'Promise' is undefined
File: powerbi.js, Line: 5557, Column: 11
Proxy(c1tbcf) did not handle message. Handlers: 3 Message: {"statusCode":202,"headers":{"id":"9bbsmd"}}.

 

Navigation issue:

 

SCRIPT5009: 'Promise' is undefined
File: powerbi.js, Line: 5557, Column: 11
SEC7120: Origin https://app.powerbi.com not found in Access-Control-Allow-Origin header.
File: reportEmbed
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

File: reportEmbed
SEC7120: Origin https://app.powerbi.com not found in Access-Control-Allow-Origin header.
File: reportEmbed
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

File: reportEmbed
SEC7120: Origin https://app.powerbi.com not found in Access-Control-Allow-Origin header.
File: reportEmbed
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

File: reportEmbed
SCRIPT438: Object doesn't support property or method 'queue'
File: localytics.min.js, Line: 15, Column: 18394
SCRIPT5009: 'Promise' is undefined
File: powerbi.js, Line: 5681, Column: 27
SCRIPT5009: 'Promise' is undefined
File: powerbi.js, Line: 5681, Column: 27
SCRIPT5009: 'Promise' is undefined
File: powerbi.js, Line: 5681, Column: 27
SEC7120: Origin https://app.powerbi.com not found in Access-Control-Allow-Origin header.
File: reportEmbed
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

File: reportEmbed
SCRIPT438: Object doesn't support property or method 'queue'
File: localytics.min.js, Line: 15, Column: 18394
SEC7120: Origin https://app.powerbi.com not found in Access-Control-Allow-Origin header.
File: reportEmbed
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

File: reportEmbed

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.