Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine a Power BI report's width and height for embedding

I am trying to embed a Power BI report into an iFrame in a web page. I have a list of reports gathered from the Power BI Rest API, and I would like to dynamically load the reports into an iFrame on the same page.

Only problem is, I can't seem to find a way to figure out the report's width and height.

I have a fixed with frame, so I'd like to calculate the needed height somehow (though if I can get the report dimensions / ratios I can figure that part out).

I can't access the iFrame content height after load due to javascript cross-domain restrictions.

like image 484
topher-j Avatar asked Jun 12 '17 20:06

topher-j


People also ask

What should be the width and height of a page in Power BI report?

16:9 ratio (default) Letter. Custom (height and width in pixels)

How do I create an embedded Power BI report?

How to embed Power BI reports into portals. Open a report in the Power BI service. On the File menu, select Embed report > Website or portal. In the Secure embed code dialog, select the link you can use to embed this content, or the HTML you can paste into your blog or website in an iFrame.

Can you embed a Power BI dashboard?

Dashboards can be embedded into your applications by using the Power BI JavaScript SDK with the dashboard embedding API and this embedding sample application shows how to do this. Additional documentation about embedding options are in the Power BI developer documentation page.


1 Answers

please try adding the code below to your embed config settings

settings: {
layoutType: models.LayoutType.Custom,
customLayout: {
 displayOption: models.DisplayOption.FitToPage
}

I hope this helps.

like image 161
Othman Dahbi-Skali Avatar answered Nov 15 '22 10:11

Othman Dahbi-Skali