如何生成Powerbi嵌入式报告的PDF输出 [英] How to generate PDF output of powerbi embedded report
问题描述
我的网页中嵌入了一份powerbi报告.我需要的是在页面上添加一个导出"按钮,并在单击该按钮时将报告导出到PDF.我怎样才能做到这一点?在线用户建议使用report.print()
或window.print()
,但两者均不适用于我.
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.
我发现了这一点,但没有帮助:打印/生成以下内容的PDF嵌入式Power Bi报告
I found this but did not help: Print/Generate PDF of embedded power bi report
请注意,我知道我可以通过PowerBI Desktop将报告导出为pdf,但需要在自定义网页上进行.
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.
任何帮助将不胜感激.
推荐答案
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
开发人员将可以在两种主要情况下为用户提供以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.
将支持以下功能:
Power BI和非Power BI用户的导出报告(SaaS和PaaS嵌入方案)
导出用户上下文(屏幕截图将包括应用的过滤器,交叉过滤器等).
导出,包括行级安全性(RLS)
导出单个页面或整个报告
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
这篇关于如何生成Powerbi嵌入式报告的PDF输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!