Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
xChristine14
Regular Visitor

Best Way (errors) when printing from Embedded PowerBI (Angular)

Hey everyone, I'm facing an issue trying to download an embedded PowerBI report from my Angular application. Ideally, we would like to compile a pdf with other elements from the page and include the PowerBI report on the custom pdf export. But, you can't use html2canvas with an iFrame, so I'm trying to just export the PowerBI report as a pdf on its own. We're between two approaches, but can't get either to work:

 

const saveParams = {
  name: "myReport"
};
report.saveAs(saveParams);

 

^ using this method, we're getting en error "Unable to save the report - Please verify you have the right permissions..." I have full permissions on the PowerBI report, and when we request the embed token, we have the accessLevel set to 'edit,' which I understand is required:

 

let embedQuery = {
  method: 'POST',
  uri: `https://api.powerbi.com/v1.0/myorg/groups/${group}/reports/${report}/GenerateToken`,
  form: {
    'accessLevel': 'edit'                             
  },
  json: true,
  auth: {
    bearer: data.access_token
  }
};

 

The other option we've tried...

 

report.print();

 

^ this does print the report to a PDF. However, it only prints the first page (out of four in the report). Is there a trick to getting it to print every page? I tried drilling down to the page level (using getPages().then(),) but that level doesn't seem to have a print() function available.

 

What is the best way to achieve our use case?

 

Thanks,

Christine

3 REPLIES 3
xChristine14
Regular Visitor

I need to try to bump this... is there a way to download a pdf of a PowerBI report from an embed that's happening in an Angular application. It seems like this should exist. If I have external uers coming to our site to check their telemetry, and they want to download their report... is that not possible because the embed is in an iFrame? It seems like this should definitely be a thing - outside the context of a dot Net application in C#

v-rzhou-msft
Community Support
Community Support

Hi @xChristine14 ,

 

As far as I know, you can export your report to PDF and then print it.

You may refer to the offical blog to learn more details.

For reference:Export Power BI report to file

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, but does this solution work for Angular applications with JavaScript? The code examples mentioned look like they're for C# and DotNet.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.