We are using a Power BI Iframe inside our application, and we have added a print button, which we can detect via one of the messages that get sent from the IFrame to the containing window.
The container checks that the message comes from the Print button, then invokes another call, which generates a PDF, based upon the slicer settings defined in the IFrame
What we want to be able to is to allow the user to click on the headings in a Power BI table, and then print the report with the same sort order that the user has selected before clicking print.
The IFrame does send out messages to the container whenever the user clicks on a heading, but we have not been able to work out how to interrogate the messages so that we can work out what was clicked. It seems that the IDs passed back from the message do not have any relationship to the PowerBI objects, and I could not find a way of matching them up.
As the IFrame is also hosted on a different site, then the browser won't let us interrogate the visual elements, either.