How to generate PDF output of powerbi embedded report

跟風遠走 提交于 2019-12-22 05:23:14

问题


I have a powerbi report embedded to my webpage. What I need is to add an "export" button to my page and export the report to the PDF when the button is clicked. How can I achieve this? People online advises using report.print() or window.print(), but both did not work for me.

var reportContainer = document.getElementById('reportContainer');

var report = powerbi.embed(reportContainer, config);
var report2 = powerbi.get(reportContainer);

console.log(report);  --returns the report
console.log(report2); --also returns the report

report.print(); --nothing happens
report2.print(); --nothing happens

var saveAsParameters = {
    name: "newReport"
};
report2.saveAs(saveAsParameters); --nothing happens report.saveas also nothing happens

window.print(); --it prints a blank page.

I found this but did not help: Print/Generate PDF of embedded power bi report

Please note that I know I can export the report to pdf via PowerBI Desktop but I need to do it on my custom web page.

Any help would be so appreciated.


回答1:


Looks like, soon that will be available as part of API (After Feb 2020).
https://docs.microsoft.com/en-us/power-platform-release-plan/2019wave2/business-intelligence/api-export-report-powerpoint-pdf-jpeg

Developers will be able to provide their users with the option to export their data in PowerPoint, PDF, and JPEG formats in two main scenarios:

Interactive mode: End users interact with a report and export their own view of the data.
Non-interactive mode: Offline generation of snapshots distributed to different people in the organization.

The following capabilities will be supported:

Export report for both Power BI and non-Power BI users (SaaS and PaaS embed scenarios)
Export user context (the screenshot will include applied filters, cross filters, etc.)
Export including row-Level security (RLS)
Export a single page or entire report



来源:https://stackoverflow.com/questions/55052150/how-to-generate-pdf-output-of-powerbi-embedded-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!