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.
16:9 ratio (default) Letter. Custom (height and width in pixels)
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With